SomeoneEls
Farmer
Previously, it took me a long amount of time just looking for strings in ILspy, since it doesnt have a search function that goes into the methods.
So! This guide will help you find a string!
You will need...
Visual Studio
You can use your stardew valley mod as you can just remove the code or comment it out when your done.
You can also just make a C# project.
Mono.Cecil NuGet package
right click on your project in VS and click "Manage NuGet Packages". Click browse and then search Mono.Cecil, then download it.
ILSpy
Download ILspy and open up StardewValley.dll.
It's in
C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley
Alright! So basically, you want the run the following code in your C# code.
In a stardew mod, you can put it temporarily in your GameLaunched method.
Run it with your string in {your string here} and youll get all the strings in the code that contain that string (unless its used in a special way without ldstr)
It will pop up in the console in the form method:stringfound
If you want to only show the exact string, change ins.Operand.ToString().Contains to ins.Operand.ToString().Equals
And thats it! Just search up that method in ILspy in order to get that code.
There is probably better ways of doing this, like with a proper commandline args and stuff, but I guess this works :P
Oh yeah, and if you want to look for a certain instruction, you can change the op code of that instruction to whatever you like by changing Mono.Cecil.Cil.OpCodes.Ldstr.
If you want to change the operand, change {yourstringhere}
So! This guide will help you find a string!
You will need...
Visual Studio
You can use your stardew valley mod as you can just remove the code or comment it out when your done.
You can also just make a C# project.
Mono.Cecil NuGet package
right click on your project in VS and click "Manage NuGet Packages". Click browse and then search Mono.Cecil, then download it.
ILSpy
Download ILspy and open up StardewValley.dll.
It's in
C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley
Alright! So basically, you want the run the following code in your C# code.
In a stardew mod, you can put it temporarily in your GameLaunched method.
C#:
Mono.Cecil.AssemblyDefinition ad = Mono.Cecil.AssemblyDefinition.ReadAssembly("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Stardew Valley\\Stardew Valley.dll");
foreach(var module in ad.Modules)
{
foreach(var type in module.Types)
{
foreach(var Method in type.Methods)
{
if (Method.Body != null)
{
foreach (var ins in Method.Body.Instructions)
{
if (ins.OpCode == Mono.Cecil.Cil.OpCodes.Ldstr && ins.Operand.ToString().Contains({your string here}))
{
Console.WriteLine(Method.Name + ":" + ins.Operand.ToString());
}
}
}
}
}
}
It will pop up in the console in the form method:stringfound
If you want to only show the exact string, change ins.Operand.ToString().Contains to ins.Operand.ToString().Equals
And thats it! Just search up that method in ILspy in order to get that code.
There is probably better ways of doing this, like with a proper commandline args and stuff, but I guess this works :P
Oh yeah, and if you want to look for a certain instruction, you can change the op code of that instruction to whatever you like by changing Mono.Cecil.Cil.OpCodes.Ldstr.
If you want to change the operand, change {yourstringhere}