[LIB] Harmony v1.2.0.1

Started by Brrainz, January 13, 2017, 04:59:21 PM

Previous topic - Next topic

Spdskatr

I think I'm getting the hang of this. Those documentations were superb  :D

*waves rainbows in the air*

If only more modders would see this post. There are still mods out there that use Hooks when it would have been much easier with a simple prefix/postfix.

Anyway, better not interrupt you discussion too much. I'm out O/
My mods

If 666 is evil, does that make 25.8069758011 the root of all evil?

darkitten

umm i looked everyplace i could and i found a folder named mono on my system but it did not contain libmono.dll.so or libmono.so or mono.dll.so .. i'm not sure what you need me to do but i'm willing to do anything to help =) would a directory tree picture help any? (using mono complete)

Brrainz

Quote from: darkitten on February 23, 2017, 07:31:40 AM
umm i looked everyplace i could and i found a folder named mono on my system but it did not contain libmono.dll.so or libmono.so or mono.dll.so .. i'm not sure what you need me to do but i'm willing to do anything to help =) would a directory tree picture help any? (using mono complete)
What about your RimWorld installation. It contains mono.

RawCode

folder named mono contains folder named bin where all binary files are stored.

issue with native bindings - developer must use very specific library, that used to construct VM, using any other library cause crashing on most methods.

Hatti

If two methods alter the same method, the library throw a error on startup and even freak out if a game loaded:
You can test it if you use the CleaningArea and the N.V.A mod. Tested on Windows 10


Could not execute post-long-event action. Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Nandonalt_VisualAddons.HarmonyPatches ---> System.ArgumentException: Object type System.Collections.Generic.List`1[Harmony.Patch] cannot be converted to target type: Harmony.Patch[]
Parameter name: val
  at System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.ObjectRecord.SetMemberValue (System.Runtime.Serialization.ObjectManager manager, System.Reflection.MemberInfo member, System.Object value) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.FixupRecord.FixupImpl (System.Runtime.Serialization.ObjectManager manager) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.BaseFixupRecord.DoFixup (System.Runtime.Serialization.ObjectManager manager, Boolean strict) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.ObjectRecord.DoFixups (Boolean asContainer, System.Runtime.Serialization.ObjectManager manager, Boolean strict) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.ObjectManager.RegisterObjectInternal (System.Object obj, System.Runtime.Serialization.ObjectRecord record) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.ObjectManager.RegisterObject (System.Object obj, Int64 objectID, System.Runtime.Serialization.SerializationInfo info, Int64 idOfContainingObj, System.Reflection.MemberInfo member, System.Int32[] arrayIndex) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject (Int64 objectId, System.Object objectInstance, System.Runtime.Serialization.SerializationInfo info, Int64 parentObjectId, System.Reflection.MemberInfo parentObjectMemeber, System.Int32[] indices) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <filename unknown>:0
  at Harmony.PatchInfoSerialization.Deserialize (System.Byte[] bytes) [0x00000] in <filename unknown>:0
  at Harmony.HarmonySharedState.GetPatchInfo (System.Reflection.MethodBase method) [0x00000] in <filename unknown>:0
  at Harmony.PatchProcessor.Patch () [0x00000] in <filename unknown>:0
  at Harmony.HarmonyInstance.<PatchAll>b__5_0 (System.Type type) [0x00000] in <filename unknown>:0
  at Harmony.CollectionExtensions.Do[Type] (IEnumerable`1 sequence, System.Action`1 action) [0x00000] in <filename unknown>:0
  at Harmony.HarmonyInstance.PatchAll (System.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0
  at Nandonalt_VisualAddons.HarmonyPatches..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (intptr)
  at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (RuntimeTypeHandle type) [0x00000] in <filename unknown>:0
  at Verse.StaticConstructorOnStartupUtility.CallAll () [0x00000] in <filename unknown>:0
  at Verse.PlayDataLoader.<DoPlayLoad>m__6F8 () [0x00000] in <filename unknown>:0
  at Verse.LongEventHandler.ExecuteToExecuteWhenFinished () [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished()
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent()
Verse.LongEventHandler:LongEventsUpdate(Boolean&)
Verse.Root:Update()
Verse.Root_Entry:Update()

Brrainz


Brrainz

I have commited a bunch of fixes to Harmony v1.0.9 (not released until fully tested). So anyone who likes to verify it can go and grab the master from https://github.com/pardeike/Harmony and test. It is important that all involved mods use that version for proper testing.

Thanks and keep the feedback coming.

Hatti

After recompiling CleaningArea and N.V.A mod with the new harmony assembly it works fine now. But havnt tested it completly. Just the usecases that are used in both mods. Good job!

BTW: Keep up with the good WIKI. Very well explained. Dont let it go bad by missing explaining features.

Brrainz

Quote from: Hatti on March 14, 2017, 02:12:11 PM
After recompiling CleaningArea and N.V.A mod with the new harmony assembly it works fine now. But havnt tested it completly. Just the usecases that are used in both mods. Good job!

BTW: Keep up with the good WIKI. Very well explained. Dont let it go bad by missing explaining features.
Thanks! Make sure you have the very-latest, I updated the master branch a few times today. Latest update fixes Traverse bugs!

Now I will test it with my own mods and if nothing special comes up, I will release version 1.0.9 officially. I still need someone to test it on Linux. I added code from RawCode that in theory should make it work on all major platforms.

So please: if anybody could test the github version on a simple example mod and see if it runs on linux. That would be super cool!

Thanks,
Andreas

Hatti

Compiled it maybe 20 minutes before the post i made.

Btw take a look at HarmonySharedState line 39. Should be "stateField == null"

Brrainz

Quote from: Hatti on March 14, 2017, 05:25:44 PM
Compiled it maybe 20 minutes before the post i made.

Btw take a look at HarmonySharedState line 39. Should be "stateField == null"
Excellent find!

Brrainz

Today I removed all platform dependent code from Harmony. I will put up a new release within this weekend. I'll update the master branch tonight. Release this weekend!

Brrainz

Alright. It's time. I released Harmony 1.0.9 and it is available on github:
https://github.com/pardeike/Harmony/releases/tag/v1.0.9

There is probably little to nothing you need to do beside a recompile with the new released dll. Since the internal sharing mechanism has changed, it is important that everyone updates to 1.0.9 as soon as possible.

Thanks to all the friendly people from the RimWorld community that helped me on the journey: Fluffy, Zhentar, UnlimitedHugs, erdelf, SkullyWag, DonationBox, Fumblesneeze and many more!

Andreas Pardeike

kanid99

I could be wrong - but it appears that with your recent update, mods that are a mix of those who have and have not taken the update breaks drawing in the game. Im getting a ton of errors like this after Call of Cthulu updated with Harmony 1.0.9 and clearly other mods in my list use Harmony :

MissingMethodException: Method not found: 'Harmony.Traverse.GetValue'.
at (wrapper dynamic-method) Verse.PawnRenderer.RenderPawnInternal_Patch1 (object,UnityEngine.Vector3,UnityEngine.Quaternion,bool,Verse.Rot4,Verse.Rot4,Verse.RotDrawMode,bool) <0x00170>
at Verse.PawnRenderer.RenderPortait () <0x001b1>
at RimWorld.PortraitRenderer.OnPostRender () <0x00027>

Robloxsina66