RimWorld

RimWorld

Character Editor
ThisIsJapes Apr 11, 2020 @ 2:06pm
compatibility issue with humanoid alien races 2.0
Exception filling window for CharacterEditor.EditorUI: System.Reflection.TargetParameterCountException: Number of parameters specified does not match the expected number. at System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) [0x00016] in <567df3e0919241ba98db88bec4c6696f>:0 at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00011] in <567df3e0919241ba98db88bec4c6696f>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 at CharacterEditor.Reflect.CallMethod (System.Type type, System.String name, System.Object[] param) [0x00016] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.RenderingTool.RenderPawnInternal (Verse.Pawn pawn, UnityEngine.Vector3 rootLoc, System.Single angle, System.Boolean renderBody, Verse.Rot4 bodyFacing, Verse.Rot4 headFacing, System.Boolean isNude, Verse.RotDrawMode bodyDrawType, System.Boolean portrait, System.Boolean headStump) [0x00544] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.RenderingTool.RenderRotated (Verse.Pawn pawn, UnityEngine.Vector3 drawLoc, Verse.Rot4 rot4, System.Boolean isNude) [0x0009c] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.Capturer.CaptureNewPawnImage (Verse.Pawn pawn) [0x0007f] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.Capturer.ToggleRendererAndCapture (Verse.Pawn pawn) [0x00010] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.BlockPerson.AToggleRenderer (UnityEngine.Color col) [0x00017] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.SZWidgets.ButtonImageCol (System.Single x, System.Single y, System.Single w, System.Single h, System.String texPath, System.Action`1[T] action, UnityEngine.Color color, System.String toolTip) [0x0002b] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.BlockPerson.DrawMainIcons () [0x00383] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.BlockPerson.Draw (System.Int32 _x, System.Int32 _y, System.Int32 _w, System.Int32 _h) [0x00092] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at CharacterEditor.EditorUI.DoWindowContents (UnityEngine.Rect inRect) [0x0003c] in <87bb8f9c30444122b91f599c6d2c3c01>:0 at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x00165] in <c8e8d421567e4ee5864626a429a27a37>:0 Verse.Log:Error(String, Boolean) Verse.Window:InnerWindowOnGUI(Int32) UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)

you are not in any way obligated to do anything about this btw, but just wanted to let you know.

mod order is just:

Harmony
Core
HugsLib
Humanoid Alien Races 2.0
Character Editor

Also this breaks when using the hanger, face, and rotate buttons.
Last edited by ThisIsJapes; Apr 11, 2020 @ 2:08pm
< >
Showing 1-14 of 14 comments
ThisIsJapes Apr 11, 2020 @ 2:45pm 
Originally posted by ThisIsJohn:
Looking into it seem you only send five params to the DrawAddons method in AlienRace, but it's expecting 6

you send

object[] param = new object[] { false, vector, pawn, quaternion, bodyFacing };

but it expects

public static void DrawAddons(bool portrait, Vector3 vector, Pawn pawn, Quaternion quat, Rot4 rotation, bool invisible)

so I guess adding an extra false in those parameters would make this exception go away? Not sure would need to test it I guess.

I guess I should note this is in your RenderingTool.RenderPawnInternal Method
Last edited by ThisIsJapes; Apr 24, 2020 @ 10:15pm
ThisIsJapes Apr 11, 2020 @ 4:43pm 
Did a Transpile test with this that effectively does what I said in the first comment and the exception goes away

I realize I'm talking to myself, but if anyone finds this useful in the future oh well.

[HarmonyPatch(typeof(RenderingTool), "RenderPawnInternal")] public static class CharacterEditorFix_Patch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { var codes = new List<CodeInstruction>(instructions); // change array size to 6 elements codes[538].opcode = OpCodes.Ldc_I4_6; // adds false as the 6th (index 5 element) codes.Insert(564, new CodeInstruction(OpCodes.Dup)); codes.Insert(565, new CodeInstruction(OpCodes.Ldc_I4_5)); codes.Insert(566, new CodeInstruction(OpCodes.Ldc_I4_0)); // codes.Insert(567, new CodeInstruction(codes[543])); codes.Insert(567, new CodeInstruction(OpCodes.Box, typeof(System.Boolean))); codes.Insert(568, new CodeInstruction(OpCodes.Stelem_Ref)); return codes.AsEnumerable(); } }
Last edited by ThisIsJapes; Apr 24, 2020 @ 10:15pm
Rzabat Apr 24, 2020 @ 10:42am 
Would you be able to release this as a sub-mod to fix this issue? Ive also been having issues with humanoid races while using Character Editor and EDB Prepare Carefully
ThisIsJapes Apr 24, 2020 @ 10:18pm 
Originally posted by Rzabat:
Would you be able to release this as a sub-mod to fix this issue? Ive also been having issues with humanoid races while using Character Editor and EDB Prepare Carefully
I know how to mod, but I've never actually released a mod before, not really sure how to go about it. I mean the code is there in the comment, if you wanna do it go ahead.
CYFire May 1, 2020 @ 9:44am 
I don't really get how your code works and how I can apply it to my game, since I love both Character Editor and HAF-Races...
Do I need to make local Copy of CE and add your code, or do I need to create a local patch mod with your code? I wish I would know whats going on -.-

Edit:... ok looked into it and just ??? tried to follow the Rimwiki c++ modding tutorial but nevermind, my brain melts. Thought being able of editing some .xml would be a promising start, but oh boy I have no clue.

So if anyone who knows what to do could either patch Character Editor for HAF2.0 or add a patching mod, I gladly take it.
Last edited by CYFire; May 1, 2020 @ 10:55am
Hurgablurg May 12, 2020 @ 11:17pm 
So, we can assume the dev doesn't care and will do nothing to fix it?
Oniwabanshu May 13, 2020 @ 7:59pm 
I got this one instead when trying to open the Bio of a Crystalloid:
https://pastebin.com/raw/rfgVE9wZ
The window to edit the face apparel and all the others can be seen correctly, but the bio is missing.
minniefinnie May 16, 2020 @ 8:10am 
has this been fixed?
Tyrant May 28, 2020 @ 12:13am 
I compiled the fix posted earlier in the thread, just drop it into the Steam\steamapps\workshop\content\294100\1874644848\Assemblies folder.

https://anonfiles.com/P9Z70c39o3/ChrEdtFix_dll
Stormtail Jun 1, 2020 @ 6:07pm 
Thanks Tyrant ;3 and John ofcourse!
Last edited by Stormtail; Jun 1, 2020 @ 6:08pm
Latex Santa Jun 2, 2020 @ 12:31pm 
@Tyrant Just tried the fix, placed the file EXACTLY where you said it should go, the BIO field in Character Editor is STILL blank. To be fair, I am also using multiple race and faction mods, none of which are Crystalloids, but the bio is still blank, on the character selection screen AND after landing.

This is the error I get:

Exception filling window for CharacterEditor.EditorUI : System.NullReferenceException: Object reference not set to an instance of an object at CharacterEditor.PawnKindTool+<>c.<GetHumanlikes>b 0 0 (Verse.PawnKindDef td) [0x00006] in <87bb8f9c30444122b91f599c6d2c3c01>:0

Some missing definitions or something. Sounds bad.
Latex Santa Jun 3, 2020 @ 2:55pm 
@Tyrant I have temporarily reduced my mod list down to these, in the following load order:

Harmony
Core
Royalty
Hugslib
Jecstools
Mod Manager
Facial Stuff 1.1
Faction Control - 1.1
Humanoid Alien Races 2.0
More Trait Slots - 1.1
More Practical Traits
some alien race (Zeta Reticulans in my case)
Character Editor

I have been steadily adding mods to it, taking care to place Character Editor at the very bottom.
I haven't had a totally blank bio screen in the character editor for at least 6 test game starts so far. Even colonists from previous games which are saved in the character editor load properly.

This is encouraging news.

Who knows, that fix may have helped after all.
Oniwabanshu Jun 9, 2020 @ 10:46am 
Make sure you don't have this mod installed:
https://steamcommunity.com/sharedfiles/filedetails/?id=1430084631
It was absolutely breaking everything..
Because all of the sudden, and without notice, it now needs the pharmacist mod by Fluuffy.
VOID  [developer] Aug 13, 2020 @ 12:33am 
rendering is working now. HAR 2.0 DrawAddons and alien skin is fixed. if you notice some other problems, give me a hint.
< >
Showing 1-14 of 14 comments
Per page: 1530 50