More Awesome Than You!
Welcome, Guest. Please login or register.
2024 November 21, 18:49:29

Login with username, password and session length
Search:     Advanced search
540287 Posts in 18067 Topics by 6545 Members
Latest Member: cincinancy
* Home Help Search Login Register
+  More Awesome Than You!
|-+  Awesomeware
| |-+  Armoire of Invincibility
| | |-+  AwesomeMod!
| | | |-+  What am I missing here? Calling private fncs...
0 Members and 1 Chinese Bot are viewing this topic. « previous next »
Pages: [1] THANKS THIS IS GREAT Print
Author Topic: What am I missing here? Calling private fncs...  (Read 5261 times)
jeffro
Asinine Airhead

Posts: 8


View Profile
What am I missing here? Calling private fncs...
« on: 2010 November 03, 14:24:23 »
THANKS THIS IS GREAT

I've been reviewing the code for the awesome.dll. I've noticed a number of calls to 'private' functions within the gameplay.systems dll.

When I try accessing a private function in my own dll, I get a 'does not contain a definition for'.

Short of setting those fncs to public, how are these private members accessed? Is it a C# Studio setting I'm missing. I'm using the 3.5 platform.

For instance,  MartialArts.GetScoreForMartialArtist. This is a privately declared fnc. I can't compile if I try calling it.

Any help?

Thanks.
« Last Edit: 2010 November 03, 15:16:43 by jeffro » Logged
J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26288



View Profile
Re: What am I missing here? Calling private fncs...
« Reply #1 on: 2010 November 03, 16:06:30 »
THANKS THIS IS GREAT

AwesomeMod is written with MSIL and is not required to adhere to encapsulation rules, as MSIL ignores all of these things. It also explodes spectacularly when misused. As mentioned in another thread, the code we deal in looks a lot like this:
Code:
    L_0000: ldarg.0 
    L_0001: callvirt instance class Sims3.Gameplay.CAS.SimDescription Sims3.Gameplay.Actors.Sim::get_SimDescription()
    L_0006: callvirt instance bool Sims3.Gameplay.CAS.SimDescription::get_TeenOrBelow()
    L_000b: ldarg.1
    L_000c: callvirt instance class Sims3.Gameplay.CAS.SimDescription Sims3.Gameplay.Actors.Sim::get_SimDescription()
    L_0011: callvirt instance bool Sims3.Gameplay.CAS.SimDescription::get_TeenOrBelow()
    L_0016: bne.un.s L_002b
    L_0018: ldarg.1
    L_0019: callvirt instance class Sims3.Gameplay.Socializing.Genealogy Sims3.Gameplay.Actors.Sim::get_Genealogy()
    L_001e: ldarg.0
    L_001f: callvirt instance class Sims3.Gameplay.Socializing.Genealogy Sims3.Gameplay.Actors.Sim::get_Genealogy()
    L_0024: callvirt instance bool Sims3.Gameplay.Socializing.Genealogy::IsParentOrStepParent(class Sims3.Gameplay.Socializing.Genealogy)
    L_0029: brfalse.s L_002d
To make a C# compiler accept such craziness involves armtwisting it into believing those are public functions, by rebuilding it from the MSIL with the private bits exposed.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
jeffro
Asinine Airhead

Posts: 8


View Profile
Re: What am I missing here? Calling private fncs...
« Reply #2 on: 2010 November 03, 16:32:31 »
THANKS THIS IS GREAT

Driving home this morning I was wondering if I were to make my calls and references to the private stuff from Reflector, instead of C# studio, if I might circumvent the problem, being just the Microsoft compiler complaining at me.

Sounds like it from what you're saying.

Thank you Mr. Awesome. I'll give that a shot.

edit: on second thought, once I make the call using Reflector, I won't ever be able to compile in C# studio again without commenting stuff out.  hmm...
« Last Edit: 2010 November 03, 16:45:41 by jeffro » Logged
jeffro
Asinine Airhead

Posts: 8


View Profile
Re: What am I missing here? Calling private fncs...
« Reply #3 on: 2010 November 03, 18:17:58 »
THANKS THIS IS GREAT

I just loaded Reflexil 1.1.

It allows changing constants as well as functions to public.

So I'll just go that route until the game throws up on it. Hopefully it won't.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.05 seconds with 21 queries.