Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 26th Mar 2018 at 7:44 PM
Unprotected .dll's is pain.
Hi, I recently tried to convert my mod from using Vanilla .dlls to using Twallan's Unprotected .dlls, but after customizing my code to fit the new levels of (un)protection, the new version of my code glitches the game so it doesn't make it to the end of the World Loading
So what I did was to throw it all to the trash and take back the old resources, but now I need to set the BuffManager.ParseBuffData method public (for once, I can't just copy/paste the code in a new method, as it massively uses other "internal" methods).

What do I have to do to change just this, in the vastness of Sims3GameplaySystems.dll ?
Ancient legends mention a tool which would automatically Unprotect any dll fed to it, but even if I manage to grab it, how do I tell it to change nothing but the thing I want to change ?
Advertisement
Space Pony
#2 Old 26th Mar 2018 at 8:27 PM
It should be line 595093
.method private hidebysig static void ParseBuffData(class Sims3.Gameplay.Utilities.XmlDbData data,
bool bStore) cil managed

change it to
.method public hidebysig static void ParseBuffData(class Sims3.Gameplay.Utilities.XmlDbData data,
bool bStore) cil managed
Test Subject
Original Poster
#3 Old 26th Mar 2018 at 8:38 PM
I guess I shall do that when modifying Sims3GameplaySystems.dll, but in which software ?
Space Pony
#4 Old 26th Mar 2018 at 8:46 PM Last edited by Battery : 26th Mar 2018 at 8:56 PM.
if youve got visual studio open the Developer command console and type in ildasm ( il disassembler)
and load the dll then go to file save
this will give you a textfileversion of the dll then use a textsoftware ( im using notepad++) to go to line 595093 make the stated changes and save

then go to the command console and type in "ilasm filepath - dll" and if you have done everything right you should get a brand new dll

oh heres a complete tutorial on dll manipulation for ts3 http://modthesims.info/t/354419
Test Subject
Original Poster
#5 Old 26th Mar 2018 at 9:51 PM Last edited by Armise : 26th Mar 2018 at 10:54 PM.
I installed VS2017 just to do that, and my output .dll is 64 Ko lighter than the source (vanilla) one, but I believe it worked. Thanx buddy.

EDIT : Nope, didn't work. The size thing doesn't seem to be the problem, since Twallan's one is 4 Ko lighter than mine, but now, nearly half of the stuff contained in the .dll is missing, according to both VC# 2008 and .NET Reflector. See : http://prntscr.com/iwr4bj
There may be some ideas why :
  • I had to move idlasm.exe and idlasm.exe.config into the .dll folder, but I didn't have to for the ilasm, so maybe they are from different build. The ildasm I took was a x64 version (two files showed up in the research results), maybe the ilasm wasn't ?
  • the line was not the one you told me, it was in the 700k - maybe it didn't decompile properly ?
  • i believe that by default, the ilasm was the 2017 one, maybe it wasn't configured as it should have been, like the 2008 one ?

EDIT2 : tried again with the other version of ildasm.exe which came up with the search results, the recompiled .dll is identical to the byte as the first recompiled one. That's not the issue.
tried to recompile using the same ilasm as in the link you provided : same result
Scholar
#6 Old 27th Mar 2018 at 9:58 AM
This tutorial can help you http://www.modthesims.info/showthread.php?t=354419 Convert the dll file to il. After that open the file in notepad++ then change protected to public with search and replace. BTW the problem with world loading shouldn't be happening, there may be some runtime errors in your code.
Test Subject
Original Poster
#7 Old 27th Mar 2018 at 4:01 PM
Quote: Originally posted by skydome
This tutorial can help you http://www.modthesims.info/showthread.php?t=354419 Convert the dll file to il. After that open the file in notepad++ then change protected to public with search and replace. BTW the problem with world loading shouldn't be happening, there may be some runtime errors in your code.

This is exactly what I tried.
The source of the error is so hard to find because to accomodate the dll change I have to change each "protected override" into "public override", and rename some methods, events, class names...
Eventually i gave up and loaded an archived version of my mod to start over. I'll try another wae.
Space Pony
#8 Old 27th Mar 2018 at 5:13 PM
Quote: Originally posted by Armise
This is exactly what I tried.
The source of the error is so hard to find because to accomodate the dll change I have to change each "protected override" into "public override", and rename some methods, events, class names...
Eventually i gave up and loaded an archived version of my mod to start over. I'll try another wae.


Well a few basic questions:
1. did the reassembling actually finish or did you get an error / unresolved members ?
2. did you just replace the one private with public or did you cange anything else ? ( i strongly recommend to just modify the things you need as they become needed)
3. did you refresh your ide (mine gets confused sometimes after changing the dll) ?
4. You gave the new dll the exact same name as the old one right ?
Test Subject
Original Poster
#9 Old 27th Mar 2018 at 5:42 PM
1. no issue visible from the batch/cmd side
2. didn't change anything else
3. I close VC# 2008 before any change in the .dlls, if that's what you mean
4. of course
Space Pony
#10 Old 27th Mar 2018 at 6:49 PM Last edited by Battery : 27th Mar 2018 at 7:39 PM.
[QUOTE=Armise]1. no issue visible from the batch/cmd side
3. I close VC# 2008 before any change in the .dlls, if that's what you mean

did you reload the dll after restarting vs ?


e: allright im still confused why it wont work
Test Subject
Original Poster
#11 Old 27th Mar 2018 at 6:56 PM Last edited by Armise : 27th Mar 2018 at 7:34 PM.
Nope, and I wouldn't know how to do that in VC# 2008, but when I tried replacing the vanilla by the fully unprotected, it worked.
Back to top