Can't find texture path...

Started by jabbamonkey, December 29, 2018, 03:51:03 PM

Previous topic - Next topic

jabbamonkey

I uploaded my graphic mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=1606246248

I am still working on adding more textures, but am hitting another wall... I am trying to add some user interface icons, but can't find out what to name some images, and where to place them...

Remove Roof Area  ... this is the menu item, under the ZONE category.  I have the images/path for "ignore" and "add" roof zones .... but can't find this one.
Bridge ... this is the "build bridge" menu item under the STRUCTURE category.  I was able to find the "remove bridge" path, but no name/path for the build bridge.

Thanks!

Mehni

public Designator_AreaNoRoof()
{
this.icon = ContentFinder<Texture2D>.Get("UI/Designators/NoRoofArea", true);


  <TerrainDef>
    <defName>Bridge</defName>
    <texturePath>Terrain/Surfaces/Bridge</texturePath>
  <uiIconPath>Terrain/Surfaces/Bridge_MenuIcon</uiIconPath>

jabbamonkey

Thanks... so I don't keep asking when I hit this wall ... where did you find these?

Mehni

There's two tools I recommend. A good decompiler with support for Unity/Mono iterators and a good text editor with a Find In Files functionality.

The current beta of ILSpy is good. Zhentar's version is also good, but it's getting a little bit dated. DnSpy is also popular. You can export the decompiled code with either of these. That'll get you all .cs files which for your purposes are a lot easier to dig through than the decompiler.

Which leads me to the Good Text Editor. Notepad++ is popular, though I prefer VSCode these days. Add the folder with the source code and all the XML defs to a workspace. Then, use its Find In Files functionality.

jabbamonkey

I already have Notepad++ ... So, I downloaded ILSpy and ran the program. Not sure how to use it... I tried opening the main exe file with ILSpy, but that didn't work.  Any help? (currently trying to redo all the trees in the game, and want to located all their paths)

LWM

Point it at /game/location/datadirectory/YourOS_Data/Managed/Assembly-CSharp.dll

If you use Windows, it'll be Windows_Data/Managed/etc, if you use Linux, Linux_Data.

Then let it decompile, and I save it as a project I can open in monodevelop (Visual Studio Community Edition, etc) or search through with whatever editor I like.  I use Linux, so I have a lot of powerful search tools at m fingertips ^.^

(I also duel boot to windows, and I really like dnSpy, fwiw)

--LWM

jabbamonkey

Ok... so, I decompiled the Assembly-CSharp.dll and got a TON of folders and files. I searched these files (and their content), and looked for specific words ... like "Camellia" (for the camellia tree texture) .. or "Berry" or "Bush" for the generic Berry Bush and didn't get any results with texture paths (results came up, but zero paths were in the document ... and I need the texture paths to know what files to replace).


LWM

Bonus sneakiness:  there are two different places to search for things: the code, and the Defs.

If you look in the RimWorld directory, there's a Mod folder, with a Core folder inside it.  Inside THAT, there are a lot more folders.  The one you want is either Defs or Languages/<your language>.  Search in the XML files for the phrase/term you're looking for.  It will often be tied to a defName or a keyed value you can cross-reference with the code.  (If you're looking for someone else's mod's stuff, it'll be in a different folder - in yet a 3rd location if you're using steam!)

It's a hot mess, but it does make modding a lot easier in some was - separating content from engine, etc.  You get used to it after a while.  Give that a search, and see if you can find what you're looking for.

--LWM

jabbamonkey

#8
Quote from: LWM on February 09, 2019, 01:02:04 AM
If you look in the RimWorld directory, there's a Mod folder, with a Core folder inside it.  Inside THAT, there are a lot more folders.  The one you want is either Defs or Languages/<your language>.  Search in the XML files for the phrase/term you're looking for.  It will often be tied to a defName or a keyed value you can cross-reference with the code.  (If you're looking for someone else's mod's stuff, it'll be in a different folder - in yet a 3rd location if you're using steam!)

I'm aware of the Core folder with the defs. That was what I was initially using before posting this thread.  But, there are plenty of images that don't show up in there (i.e. alot of User Interface graphics). So, that was why I started looking at decompiling ... to find the other ones.

A good example is the Camellia tree texture ... nothing shows up when I search the CORE folder. And nothing shows up when I search the decompiled files.

An example of a texture that shows up in the decompiled code, but not in the CORE files is the NoRoofArea icon...
Quotethis.icon = ContentFinder<Texture2D>.Get("UI/Designators/NoRoofArea", true);

LWM


LWM

(oh, hey, now I know what that tree outside my parents' house is!)