Ludeon Forums

RimWorld => Mods => Help => Topic started by: donoya on December 24, 2016, 11:00:14 PM

Title: Really strange crash upon trying to open the modded research tree
Post by: donoya on December 24, 2016, 11:00:14 PM
I finally figured out how to detour the research tree (with the help of a few people), but when we tried to open the research tab in the game, it crashed without any warning or error being shown. Here is the only bit of information we got from the output log:
RW_Revamped_Transcendence injected.
Verse.Log:Message(String)
RW_Revamped_Transcendence.DetourInjector:Inject()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__733()


I've attached the class files in this post.

[attachment deleted by admin due to age]
Title: Re: Really strange crash upon trying to open the modded research tree
Post by: 1000101 on December 25, 2016, 03:59:09 AM
What is happening is infinite recursion which is causing a stack overflow.  You can't detour a method then call the base method because you've detoured the base method and therefore you are actually calling your detour.
Title: Re: Really strange crash upon trying to open the modded research tree
Post by: RawCode on December 25, 2016, 06:51:52 AM
injection code implemented by CCL designed to replace method with other method fully and completely.
"new" method expected to be completely independent from original method, you should not extend type, that host original method, you should not try to call original method or rely on it in any form.

if you need function of original method, you MUST reimplement it inside your own code.
Title: Re: Really strange crash upon trying to open the modded research tree
Post by: DaemonDeathAngel on December 25, 2016, 11:27:59 AM
So what he is needing to do is rewrite the entirety of the research tab code and allow it to include only specified research?
Title: Re: Really strange crash upon trying to open the modded research tree
Post by: RawCode on December 25, 2016, 05:55:43 PM
yes, you must provide complete replacement for method, you are not allowed (by current implementation) to replace part of method.

to call "base" ignoring type safety and other things, you may rely to __asm31 routine posted by me some time ago.

same routine can be used for many other "things", just perform some research or wait for others to do it for you.
Title: Re: Really strange crash upon trying to open the modded research tree
Post by: DaemonDeathAngel on December 25, 2016, 05:58:35 PM
We would rather not have to wait for someone else to do it, as we are hoping to be able to release something within the next few weeks. I have found a workaround temporarily, but it's only that, temporary.
Title: Re: Really strange crash upon trying to open the modded research tree
Post by: RawCode on December 25, 2016, 09:59:57 PM
i had posted code snippets that already allows to do anything, including method invocation ignoring type protection and access to fields ignoring any rules, sadly, it's all one big "workaround" and there are no ways to do it "correctly" without brewing custom mono.dll