Announcement

Collapse
No announcement yet.

DMT Modding Tool

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #76
    Originally posted by sphereii View Post
    Those two errors are from building the mod against 18.3. they will need a patch before they'll work with that experimental
    what a patch?

    Comment


      #77
      Originally posted by belfegor View Post
      what a patch?
      https://github.com/SphereII/SphereII...tree/Alpha18.3

      There is my 18.3 repo. You just need 0-SphereIICore to get it to compile.

      Comment


        #78
        thank you !

        Comment


          #79
          Solved: Harmony doesn't seem able to patch static methods.
          Besides, my requirement meant checking the instance type, which isn't possible in a static method.

          I solved this by patching a different, non-static method to achieve what I wanted to do




          Is there something special I need to do to patch static methods?

          Take this example


          Spoiler: 
          Code:
          class Tim_Test {
              public class Tim_Test_Init : IHarmony {
                  public void Start () {
                      Debug.Log (" Loading Patch: " + this.GetType ().ToString ());
                      var harmony = HarmonyInstance.Create (GetType ().ToString ());
                      harmony.PatchAll (Assembly.GetExecutingAssembly ());
                  }
              }
          
              [HarmonyPatch (typeof (BlockPoweredDoor))]
              [HarmonyPatch ("Init")]
              public class Tim_BlockPoweredDoor_Init {
                  public static bool Prefix (BlockPoweredDoor __instance) {
                      Debug.Log ("Type: " + __instance.GetType ().Name);
                      return true;
                  }
              }
          
              [HarmonyPatch (typeof (BlockPoweredDoor))]
              [HarmonyPatch ("IsDoorOpen")]
              public class Tim_BlockPoweredDoor_IsDoorOpen {
                  public static bool Prefix (BlockPoweredDoor __instance) {
                      Debug.Log ("Type: " + __instance.GetType ().Name);
                      return true;
                  }
              }
          }
          In this case, the patch for "Init" works, as the log can be seen in the console, however the patch for "IsDoorOpen", does not, as under no circumstance does a log appear in the console (placing, turning on power, etc).

          The only difference between the two methods is vanilla "Init" is:
          Code:
          public override void Init()
          whereas vanilla "IsDoorOpen" is:
          Code:
          public static bool IsDoorOpen(byte _metadata)


          Any help pointing me in the right direction would be greatly appreciated
          Last edited by timbeswick; 01-20-2020, 08:07 PM. Reason: Solved

          Comment


            #80
            This is the Discord forum is where most of the C# modders hangout and will answer your questions much faster than on these forums: https://discord.gg/gKdwBmH

            Comment


              #81
              Hello,

              In "MyMod/Script/some_folder/", I have a VScode project executing some Main() (for testing purpose). When I build using DMT, some dll (produced by me running test) in "MyMod/Script/some_folder/obj/" are written to the root folder of 7D, causing the game to crash (probable cause: different c# version between the 2 dll).
              Is there a way to prevent such files to be moved (or maybe better practice for me when running test) ?


              Also a random suggestion: could the tool manage the order of mods by renaming them (eg "0_", 1_" ...) before applying them ? There would be some config file storing order for the build. (I did not run into order issue myself yet though)

              Comment


                #82
                hey guys been having a problem with DMT not working I don't know what to do the error message is this

                Running BackupFiles
                Backup dll found: D:\DMT/Backups/SP/18.3b4/Assembly-CSharp.dll
                Running DeployDlls
                Deploying DLLs
                Running LocalisationPatch
                PatchFile: D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt
                D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt detected BOM in file

                Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
                at System.ThrowHelper.ThrowArgumentException(Exceptio nResource resource)
                at System.Collections.Generic.Dictionary`2.Insert(TKe y key, TValue value, Boolean add)
                at LocalisationTable.ReadFromStream(BinaryReader br, String path)
                at LocalisationTable.Load(String path)
                at DMT.Tasks.LocalisationPatch.PatchTextFile(PatchDat a data, String sourcePath, String destPath, String patchFilePath)
                at DMT.Tasks.LocalisationPatch.Patch(PatchData data)
                at DMT.PatchData.Patch()
                at DMTViewer.Program.Main(String[] args)

                process exited with error code -532462766

                please help

                Comment


                  #83
                  Originally posted by Chaos7h30ry View Post
                  hey guys been having a problem with DMT not working I don't know what to do the error message is this

                  Running BackupFiles
                  Backup dll found: D:\DMT/Backups/SP/18.3b4/Assembly-CSharp.dll
                  Running DeployDlls
                  Deploying DLLs
                  Running LocalisationPatch
                  PatchFile: D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt
                  D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt detected BOM in file

                  Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
                  at System.ThrowHelper.ThrowArgumentException(Exceptio nResource resource)
                  at System.Collections.Generic.Dictionary`2.Insert(TKe y key, TValue value, Boolean add)
                  at LocalisationTable.ReadFromStream(BinaryReader br, String path)
                  at LocalisationTable.Load(String path)
                  at DMT.Tasks.LocalisationPatch.PatchTextFile(PatchDat a data, String sourcePath, String destPath, String patchFilePath)
                  at DMT.Tasks.LocalisationPatch.Patch(PatchData data)
                  at DMT.PatchData.Patch()
                  at DMTViewer.Program.Main(String[] args)

                  process exited with error code -532462766

                  please help
                  Are you using the latest version of DMT, available in the first post?

                  Comment


                    #84
                    I've had a decent amount of time to play around with DMT and Alpha 18.1 through 18.3, and I just wanted to thank whoever made DMT, Harmony, SDX, and the tutorials for all three. They're excellent tools. It's been challenging but fun to create the few little mods I'd been wanting, and I'd never have been able to get anywhere if it weren't for the documentation that was written, so thanks a lot for all the work that's been put in.

                    Comment


                      #85
                      Originally posted by sphereii View Post
                      Are you using the latest version of DMT, available in the first post?
                      i'll give this a test now I think I have been but haven't tried for a week so will check now

                      Comment


                        #86
                        Originally posted by sphereii View Post
                        Are you using the latest version of DMT, available in the first post?
                        i'll give this a try now I think I have used the latest but i'm quite noobish at setting this up is there a tutorial for using it because i'd love to get the npc's in there

                        Comment


                          #87
                          Ask for help.How shoule I use System.IO.File.Exists to search the Dedicated Server rather than search my local game save folder? The same about File.WriteAllText and File.Delete.I host My server on a server .But when I Use file opration,It did on my own personal PC. Help Thanks

                          Comment

                          Working...
                          X