Decompiling a tmod file (Lost all code)

BTGF

Terrarian
So i had to factory reset due to some things and i forgot to backup my mod while doing so and i am wondering if there is any way i can decompile a tmod file with the code i still have all the images and sounds though.
 
So i had to factory reset due to some things and i forgot to backup my mod while doing so and i am wondering if there is any way i can decompile a tmod file with the code i still have all the images and sounds though.
Sure thing. You can decompile a mod just like you can demcompile the entire game. You just need to grab the assembly from .tmod file using TModLoader's built-in extractor, then throw that into ILSpy along with all the dependencies terraria has. Export the whole thing, fix the directory structure, and recreate the .csproj and build.txt files.
 
Sure thing. You can decompile a mod just like you can demcompile the entire game. You just need to grab the assembly from .tmod file using TModLoader's built-in extractor, then throw that into ILSpy along with all the dependencies terraria has. Export the whole thing, fix the directory structure, and recreate the .csproj and build.txt files.
Ok thanks!
 
No problem. :) Feel free to ask if you need any additional help with this.
This might be a bit too late but some of the code is kinda messed up and im wondering if there is any way to fix it or i have to fix it manually.
Capture.PNG
 
Sure thing. You can decompile a mod just like you can demcompile the entire game. You just need to grab the assembly from .tmod file using TModLoader's built-in extractor, then throw that into ILSpy along with all the dependencies terraria has. Export the whole thing, fix the directory structure, and recreate the .csproj and build.txt files.
ummm. had the same problem, how do i do that?
 
When I extracted a mod, it had the same issues and I went and fixed them all manually. I don't really know if there is an automated way to do it
 
Oops, looks like I blanked on a few notifications again... Sorry about that. It might be a bit late now, but I'll clear things up, for future reference.

How would I be able to get the assembly if TML wont get it?
If tModLoader doesn't give you the assembly, that means the mod author decided to hide it. There are still ways to get it out, it's not that hard to figure out, if you know what you're doing. I won't tell you how to do it here though, for reasons that I hope are obvious...

This might be a bit too late but some of the code is kinda messed up and im wondering if there is any way to fix it or i have to fix it manually.
View attachment 278741
That is most likely happening because ILSpy didn't find a reference assembly. It doesn't know that projectile is a property, so just assumes get_projectile is a regular method. To get source code that isn't garbled, I'd recommend manually dragging tModLoader.exe and all the assemblies from %userprofile%/My Games/Terraria/ModLoader/References into ILSpy before exporting.
 
Back
Top Bottom