Need help reverse engineering dll file

Started by Vampiresbane, November 18, 2022, 01:05:34 AM

Previous topic - Next topic

Vampiresbane

Hello all,
First time modder here and I'm working on an "expansion" of the Roads of the Rim mod. 
I've hit two issues I need help with.

First, I need to remake the dll (Assembly) file, but I'm not sure how so I can add five more RoadDefs.  I was hoping to just edit the dll file using Visual Studio, but either you cannot actually do that or I just cannot figure it out.  I tried using dnSpy, but as far as I can tell, that just lets me look at the code inside the dll, not actually copy it or edit it. 

Second, I need to either add tabs or widen the ingame menu for building roads while on the world map.  As you can see, with everything I've added (small preview), not all the options are displayed. 
https://imgur.com/uyHHkxW

Third and something I might be able to figure out myself is somehow the construction icons on the world map are not displaying the correct text.

Fixing or finding an answer to the first two are much more important though.  So if anyone can help, let me know.

Vampiresbane

#1
I figured it out, all of it.
1. So you can't "reverse engineer" dll files.  At least not easily...but you can open the original C# and sln file if the original author uploaded them to github and rebuild/edit the old sln file while updating a new and improved dll file that Rimworld will eventually use.  And btw, all I needed was Microsoft Visual Studio.  I didn't need dnSpy at all.

This video helped a lot for a guy like me who had 0 experience with C#, sln, or dll files. 
https://www.youtube.com/watch?v=UgCOhFzeX4A

2. Widening the menu was hard, but I finally figured it out. 
    public class ConstructionMenu : Window
    {
        private readonly RoadConstructionSite site;
        private readonly Caravan caravan;
        private readonly List<RoadDef> buildableRoads;
        public override Vector2 InitialSize => new Vector2(676+128, 544+128);

The "676+128" is the x value for the menu width.  By increasing it I could fit everything I needed.  Interestingly enough, either Nekko or Jecrell had left notes right under this spot reminding himself to go back and make the menu self-update ingame to the width required, but it looks like neither did that and I don't have the coding chops to figure it out though I did try. 

3. It was a simple naming error that I had made.  Once I found it and named the def correctly, it fixed the issue.  #1 and #2 were much more difficult. 

And final preview while I'm getting everything put together and ready for publishing the mod (the final fixed result for #2):
https://imgur.com/IEGRACC