[A14] Community Core Library v0.14.3.1

Started by RWCCLTeam, October 20, 2015, 12:08:13 PM

Previous topic - Next topic

Dakkon

1000101 you made a mistake? You're not perfect?

My illusion is shattered, what's real? I just don't know anymore.

Fluffy (l2032)

I think E's mistake in this case was trusting I wouldn't make mistakes. While he should no better, I think we can let him slide on this one.

( The code was fine, and then I introduced two bugs in one commit. At least you guys didn't report/notice the other one, so that doesn't really count :P )

RemingtonRyder


jediminer543

Could someone explain how the detour injection code works. I'm curious, but it seems to use assembly magic.

1000101

#169
The detour injector replaces the first few bytes of the source method with an (machine code/CPU instruction) jump to the destination method.

It's not magic ;), it's x86 (32-bit) or x86-64 (64-bit) machine language.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Fluffy (l2032)

Trust me, it's magic. Dark, dark, magic.

Jaxxa

I have a few specific questions about detours.


  • Can I Detour a Property or only Functions?
  • Is it possible for My Detoured Function to access Other Functions / Variables / Properties in the Class I am Replacing or My New Detour Class?

1000101

Quote from: Jaxxa1. Can I Detour a Property or only Functions?
A property is only syntactic sugar.  What a property really is, is a field and two functions (a getter and a setter).  You can get both methods (PropertyInfo.GetGetMethod, PropertyInfo.GetSetMethod) and detour them like any other.


Quote from: Jaxxa2. Is it possible for My Detoured Function to access Other Functions / Variables / Properties in the Class I am Replacing or My New Detour Class?
Absolutely, but depending on "how" you define the class and detour method will determine the level of protection and "ease of access" to the detoured class and method.  ie, if you are detouring an instance class and method, the "easiest" way is to define the class and method using inheritance.  This allows you to reference members which are public or protected and use "this".  Private and internal members will always need reflection.


CCL has quite a range of methods including in sealed and internal classes; internal, private, protected and public methods.  I wrote all the detours as internal static classes with internal static extension methods.  I chose to write them in this way to prevent "accidental" references in mods.

The only real caveat to detouring a function is whether the compiler/JIT will automatically inline the function.  Functions which have been inlined can't be detoured (well, they can be but your detoured method will never be called as there is no call to the method).  Read this article, the important part is the section entitled "Method Inlining."
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Jaxxa

Thanks, that was just the information I was after.

Rock5

I was checking out the fertility of various natural terrain in the help menu and noticed Gravel was missing. Just thought I'd report it.
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

1000101

Yeah, some floors and terrain is missing.  It's all programmatically detected and categorized so there may be a tag or something missing.

We'll look into it and see what we can do, thanks.  :)
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Thorbane

#176
I downloaded the latest version from github, moved my saves and everything else to a backup file, redownloaded Rimworld, and I can confim the save/load bug is still very much alive on linux.

Rolling back to version 0.13.1.1 has fixed it for now.

1000101

We need your mod list, world, save and log files to diagnose.  Please open an issue in our tracker (noting platform and version) and attach those.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

notfood

#178
Linux user here.

Modlist is just Core and CCL 0.13.2.1

World was just created. Any world fails.

Crash happens on colony load. This is the log:
http://pastebin.com/raw/uBBDyiZY

1000101

#179
Thank-you for the detailed log.  It will be very helpful!  :)

New issue added to the tracker.  Keep an eye on this issue for details as we try to fix it.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By