Skip to content

Commit

Permalink
Fix wiki images
Browse files Browse the repository at this point in the history
  • Loading branch information
doombubbles committed Apr 10, 2024
1 parent 1baeff8 commit 447c66e
Show file tree
Hide file tree
Showing 26 changed files with 103 additions and 72 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- '*'
tags:
- '*'
paths:
- BloonsTD6 Mod Helper/**
pull_request:
branches:
- '*'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./Website/out
exclude_assets: '.github,**/.gitignore'
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'

3 changes: 0 additions & 3 deletions Website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"private": true,
"description": "BTD Mods",
"author": "doombubbles",
"keywords": [
"gatsby"
],
"scripts": {
"dev": "next dev",
"prebuild": "ts-node src/scripts/prebuild.ts",
Expand Down
1 change: 1 addition & 0 deletions Website/public/wiki/images/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png
26 changes: 26 additions & 0 deletions Website/src/scripts/prebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import * as fs from "fs";
import path from "path";
import { globSync } from "glob";
import { chain } from "lodash";
import wiki from "../pages/wiki";

// Create maps list

const dataFolder = path.join(process.cwd(), "src", "data");
const mapsFolder = path.join(process.cwd(), "public", "images", "BTD6", "Maps");
Expand All @@ -24,3 +27,26 @@ fs.writeFileSync(
path.join(dataFolder, "maps.json"),
JSON.stringify(maps, null, 2)
);

console.log("Created maps.json");

// Copy wiki images

const wikiFolder = path.join(process.cwd(), "..", "Wiki");
const publicFolder = path.join(process.cwd(), "public", "wiki", "images");

const publicImages = globSync(
path.join(publicFolder, "**", "*.png").replaceAll(path.sep, "/")
);

publicImages.forEach((value) => fs.rmSync(value));

const wikiImages = globSync(
path.join(wikiFolder, "**", "*.png").replaceAll(path.sep, "/")
);

wikiImages.forEach((value) =>
fs.copyFileSync(value, path.join(publicFolder, path.basename(value)))
);

console.log("Copied wiki images");
12 changes: 6 additions & 6 deletions Wiki/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ You'll want to make a new project of the type "Class Library (.NET Framework)"

## IMPORTANT: For the folder to create your project in, you should choose the "BTD6 Mod Sources" directory which is generated by default in your Documents folder when running the game with Mod Helper installed. If it's the correct folder, it will have a `btd6.targets` file in it.

![Screenshot of Visual Studio Project Creation](https://media.discordapp.net/attachments/800115046134186026/859511093650128916/unknown.png)
![Screenshot of Visual Studio Project Creation](images/vs-project-creation.png)

I'd recommend checking the "Place Solution and project in the same directory" box on the next page, but that's up to you.

# Dependencies

The new, easy way of doing dependencies is to utilize the `btd6.targets` file. With your project opened up, double click your project in the solution explorer to edit your .csproj file. You'll want to add the line `<Import Project="..\btd6.targets" />` near the bottom, which will look something like this

![csproj editing screenshot](https://media.discordapp.net/attachments/800115046134186026/1044775457230426132/image.png)
![csproj editing screenshot](images/csproj-editing.png)

<details>
<summary>The Old / Manual Way of doing dependecies</summary>
<br>

![Screenshot of Visual Studio Reference Adding](https://media.discordapp.net/attachments/800115046134186026/859515434663411712/unknown.png)
![Screenshot of Visual Studio Reference Adding](images/vs-reference-adding.png)

You will want to add the following files as dependencies for your mod:

Expand All @@ -37,7 +37,7 @@ Reccomended

The most common location for your BloonsTD6 folder is "C:\Program Files (x86)\Steam\steamapps\common\BloonsTD6" but you can also find it by going to steam and do Manage -> Browse Local Files

![Screenshot of Steam browse local files](https://media.discordapp.net/attachments/800115046134186026/859515064989384734/unknown.png)
![Screenshot of Steam browse local files](images/steam-local-files.png)

</details>

Expand Down Expand Up @@ -66,13 +66,13 @@ This will be important for many Mod Helper features, like Towers, In Game Mod Se

To actually compile your mod, you're going to want to enable the "Build Toolbar" in Visual Studio.

![Screenshot of visual studio build toolbar](https://media.discordapp.net/attachments/800115046134186026/859517262377648168/unknown.png)
![Screenshot of visual studio build toolbar](images/vs-build-toolbar.png)

Then, when you hit the Build Button, it will compile your mod and create your .dll file in the "...\YourModName\bin\Debug\" folder by default.

If you don't want to have to move the .dll file from there to your mods folder every time, then you can add a Post-Build Event to copy it.

![Screenshot of Visual Studio post build event](https://media.discordapp.net/attachments/800115046134186026/859518003287556146/unknown.png?width=1167&height=702)
![Screenshot of Visual Studio post build event](images/vs-postbuild.png)

The text is `copy "$(TargetDir)$(TargetFileName)" "C:\Program Files (x86)\Steam\steamapps\common\BloonsTD6\Mods" /y`

Expand Down
Binary file added Wiki/Images/csproj-editing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/dnspy-analyze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/dnspy-export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/dnspy-search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/dnspy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/doc-comment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/internal-failure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/mods-folder-after.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/mods-folder-before.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/no-assembly-csharp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/steam-local-files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/vs-build-toolbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/vs-postbuild.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/vs-project-creation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Wiki/Images/vs-reference-adding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 45 additions & 11 deletions Wiki/Install-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,32 @@ We can't help you if you don't own a legitimately acquired copy of BTD6 on Steam

**Mods for Android, IOS, or pirated clients are not supported**

## 2. Install MelonLoader
## 2 Download the .NET Runtime

If you don't have or are unsure whether you have the .NET 6.0 (or higher) runtime, you
should [download it from Microsoft](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-6.0.29-windows-x64-installer)

It is **required** for MelonLoader to work for IL2CPP games like BTD6.

## 3. Install MelonLoader

BTD Mod Helper requires <u>MelonLoader v0.6.1</u> or above. You should follow
the [instructions here](https://melonwiki.xyz/#/?id=automated-installation) for downloading and using the MelonLoader
installer. By default your BloonsTD6 folder will be located somewhere
like `C:\Program Files (x86)\Steam\steamapps\common\BloonsTD6`. If that's not correct, you can right click the game in
your Steam library and select "Manage" > "Browse Local Files" to see where they are.
your Steam library and select "Manage" > "Browse Local Files" to see where they are. For Epic, the default install path
is or `C:\Program Files\Epic Games\BloonsTD6`.

After the installation, tour BloonsTD6 Folder should then look something like this:

![BloonsTD6 Folder Screenshot before running MelonLoader](https://media.discordapp.net/attachments/800115046134186026/1007815593250017403/unknown.png)
![BloonsTD6 Folder Screenshot before running MelonLoader](images/mods-folder-before.png)

Then, the next time you open the game, MelonLoader will spend some time generating the files it needs and also a new
Mods folder within your BloonsTD6 folder. It oughta look similar to

![BloonsTD6 Folder Screenshot after running MelonLoader](https://media.discordapp.net/attachments/800115046134186026/1007815991578869840/unknown.png)
![BloonsTD6 Folder Screenshot after running MelonLoader](images/mods-folder-after.png)

## 3. Install BTD Mod Helper
## 4. Install BTD Mod Helper

Download the latest `BTD6ModHelper.dll` from the [GitHub releases](https://github.com/gurrenm3/BTD-Mod-Helper/releases).
You can also press the shiny green button on the main page or just
Expand All @@ -33,7 +41,7 @@ version older than 3.0, make sure to delete any previous `BloonsTD6 Mod Helper.d
If you've done everything right, you should see a new "Mods" button in the bottom right corner of the BTD6 main menu
when you run the game. (Remember that you need to restart to change mods!)

## 4. Install more Mods
## 5. Install more Mods

As of Mod Helper 3.0 you can use the in-game Mod Browser to view mods that have been published on GitHub.

Expand All @@ -46,17 +54,43 @@ all you need to do is save/put the .dll file into your Mods folder in the same w

The other best place for finding mods is from one of the BTD6 Modding discord communities:

[BTD6 Mods and Discusion](https://discord.gg/NnD6nRH)

[1330 Studios](https://discord.com/invite/1330studios)
[BTD6 Mods and Discussion](https://discord.gg/NnD6nRH)

It's not recommended for you to get mods from other sites such as Nexus Mods. Nothing against the site itself, but for
BTD6 it just never caught on as a place for quality, good intentioned mods.

## Troubleshooting

For a more in depth guide with more troubleshooting
see [this guide](https://hemisemidemipresent.github.io/btd6-modding-tutorial/)
## Common Issues

### Internal Failure / il2cpp_init_detour / .NET 6.0 runtime

![Screenshot of Internal Failure il2cpp_init_detour error](images/internal-failure.png)

This is the error you will get if you try to run the game without having the .NET 6.0 (or higher) Runtime.
Please [download it from Microsoft](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-6.0.29-windows-x64-installer).

### Missing Assembly-Charp.dll

![Screenshot of Internal Failure il2cpp_init_detour error](images/no-assembly-csharp.png)

An error such as `Could not load file or assembly 'Assembly-CSharp, ...'` means that MelonLoader did not install
correctly.

Open up the MelonLoader installer again and use the Uninstall feature. Then, try installing and opening the game again,
making any/all of the following changes

- Run the MelonLoader installer as Administrator
- Temporarily disable any anti virus software your computer uses
- Use a different minor version of MelonLoader (e.g. choose 0.6.1 in the dropdown instead of 0.6.2)

## Other Tips

You should **not** rename the BloonsTD6.exe file to anything else, or use different names for mod dll files.

You should also **not** copy the BloonsTD6 install folder to somewhere else and run it from there.
You can make backups of your install folder, but always run the game from the actual path that Steam or Epic considers
it to be installed at.

## Uninstalling

Expand Down
29 changes: 19 additions & 10 deletions Wiki/Looking-at-BTD6-Code-(Sorta).md
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@


# dnSpy

[dnSpy](https://github.com/dnSpy/dnSpy/releases) is a program that lets you look into compiled Assemblies to see their code, to a certain extent. For Bloons TD 6, this means we'll be opening `...\BloonsTD6\MelonLoader\Managed\Assembly-CSharp.dll` file to look at the Main Bloons TD 6 code. It'll look something like this: ![Screenshot of dnSpy](https://media.discordapp.net/attachments/800115046134186026/859498956270862356/unknown.png)
[dnSpy](https://github.com/dnSpy/dnSpy/releases) is a program that lets you look into compiled Assemblies to see their
code, to a certain extent. For Bloons TD 6, this means we'll be
opening `...\BloonsTD6\MelonLoader\Managed\Assembly-CSharp.dll` file to look at the Main Bloons TD 6 code.
It'll look something like this: ![Screenshot of dnSpy](images/dnspy.png)

You can navigate around the Assembly just using dnSpy, especially using the search function:
![screenshot of dnSpy search](https://media.discordapp.net/attachments/699781597515481159/927370134887215134/unknown.png)
![screenshot of dnSpy search](images/dnspy-search.png)

or you can go to File -> Export to Project to save it as a .csproj that you can open up in your favorite IDE to navigate around in a more familiar way. ![Screenshot of dnSpy Exporting to project](https://media.discordapp.net/attachments/800115046134186026/859500013431160872/unknown.png?width=1250&height=702)
or you can go to File -> Export to Project to save it as a .csproj that you can open up in your favorite IDE to navigate
around in a more familiar way.
![Screenshot of dnSpy Exporting to project](images/dnspy-export.png)

## Limitations

Unfortunately, due to the game's usage of [IL2CPP](https://github.com/gurrenm3/BTD-Mod-Helper/wiki/IL2CPP-Is-Weird), we're limited in what we can see through this method.
Unfortunately, due to the game's usage of [IL2CPP](https://github.com/gurrenm3/BTD-Mod-Helper/wiki/IL2CPP-Is-Weird),
we're limited in what we can see through this method.

### What We CAN See

* File, Method, Field, Property Names
* Method, Field, Property types used
* Number of times a Method/Class is used (using Analyze)

![Screenshot of Analyze](https://media.discordapp.net/attachments/699781597515481159/927370622038863903/unknown.png)
![Screenshot of Analyze](images/dnspy-analyze.png)

### What we CAN'T See

* The actual code within method bodies
* The places where methods get called

When you look around the code, you'll basically as see the same pattern of Method stub used, which is basically: Convert parameters to C++y forms, call the particular C++ compiled native method, manually raise necessary exceptions.
When you look around the code, you'll basically as see the same pattern of Method stub used, which is basically: Convert
parameters to C++y forms, call the particular C++ compiled native method, manually raise necessary exceptions.

Needless to say, that information isn't really useful. This is not a method that will let you get an understanding of what Methods actually do and how they do it.
Needless to say, that information isn't really useful. This is not a method that will let you get an understanding of
what Methods actually do and how they do it.

Still, it can be useful to look at all the Names and Types of things within a Class

# ADVANCED: IDA

You can use decompilation software like IDA on "...\BloonsTD6\GameAssembly.dll" to look at the actual assembly code to see what methods do, or more accurately, look at IDA's attempt to generate C Pseudocode for that assembly code.
You can use decompilation software like IDA on "...\BloonsTD6\GameAssembly.dll" to look at the actual assembly code to
see what methods do, or more accurately, look at IDA's attempt to generate C Pseudocode for that assembly code.

More info coming at a later time.
2 changes: 1 addition & 1 deletion Wiki/Prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ To be able to see all this documentation from within your IDE, all you have to d

Then, you should be able to see helpful comments like on Mod Helper methods like this

![Screenshot of doc comment popup](https://media.discordapp.net/attachments/800115046134186026/859521355521982484/unknown.png)
![Screenshot of doc comment popup](images/doc-comment.png)
41 changes: 0 additions & 41 deletions Wiki/Switching-to-MelonLoader-0.6.0.md

This file was deleted.

2 changes: 2 additions & 0 deletions Wiki/_Sidebar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
##### [Home](/wiki/Home)

##### [Install Guide](/wiki/Install-Guide)

###### Starting BTD Modding

[Prerequisites](/wiki/Prerequisites)
Expand Down

0 comments on commit 447c66e

Please sign in to comment.