Announcement

Collapse
No announcement yet.

Cecil.Inject - An extension to Mono.Cecil [1.2.6]

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Utilities] Cecil.Inject - An extension to Mono.Cecil [1.2.6]

    Cecil.Inject1.2.6
    Looking for ReiPatcherPlus? The library has been renamed to Cecil.Inject. Read the second post if you still need to use ReiPatcherPlus.

    (Mono.)Cecil.Inject is a library that adds a basic set of methods found in System.Reflection and the ability to inject methods.

    The library is a successor to ReiPatcherPlus -- an extension library to ReiPatcher.

    The main features and updates from ReiPatcherPlus include
    • Dependency on ReiPatcher has been removed; it is now possible to use this library everywhere with Mono.Cecil
    • Extensions to TypeDefinition to get methods by name and parameter types (same method signatures like in System.Reflection)
    • Method injection has been revised and reorganized to make the process more seamless
    • Renamed structures and methods to better reflect their purpose and function
    • It is now possible to search for and change the access of locked class fields (private, protected, read-only) with a regular expression
    • Debugging and logging has been revamped to be easier and slicker
    • ... and much more minor things!
    Download the latest version
    Current version: 1.2.6

    IMPORTANT NOTE REGARDING VERSIONS 1.2.6+
    Cecil.Inject version 1.2.6 introduced some changes that in the future will make assemblies that use Cecil.Inject 1.2.4 or older unusable!
    Thus, if you are a developer, update your assemblies to support new Cecil.Inject. A simple recompile will work most of the time.

    Which one should I download?
    Download RELEASE if you are an end-user who needs Cecil.Inject to make some plug-in or program work.
    Download DEV if you are a developer who wants to use Cecil.Inject in one's projects. The Dev version provides logging capabilities to simplify debugging. Note that only this version contains the documentation XML.

    Installation (Users):
    Copy the file "Mono.Cecil.Inject.dll" to the directory where "Mono.Cecil.dll" is (or otherwise specified by the plug-in/program you use Cecil.Inject in).
    Hint for ReiPatcher users: Mono.Cecil.dll is in the same folder as ReiPatcher.exe.

    More information (changelogs, documentation, ReiPatcherPlus) in the second post!
    Last edited by denikson; 05-23-2017, 09:21 AM.

  • #2
    Changelog
    • 1.1
      - Added partial parameter passing (injection methods don't need to have all target method parameters in their signature)
      - Added method matching (search for methods that have at least the specified parameters in the right order)
      - Minor optimisations to GetMethod -methods
    • 1.0.1
      - Injection methods should now not break possible instruction references
    • 1.0
      - Initial release


    Documentation
    The DEV version Cecil.Inject comes with basic XML documentation for use with IDEs. However, one can get more thorough information about the library here.
    Currently there are two documents: migration guide aimed at the developers coming from ReiPatcherPlus and a fully-fledged documentation for everyone.
    You can download them here:
    Migration guide for ReiPatcherPlus
    Full documentation of Cecil.Inject

    Source code and redistribution
    The source code of Cecil.Inject is freely available on GitHub. The project is licensed under the MIT license, which means that you are free to edit and distribute this library (as long as you remember mention yours truly, that is). That being said, you are allowed to either link people to this thread and have them download the latest version of Cecil.Inject from here or you can simply include Cecil.Inject alongside your plug-in/solution, as per MIT license.

    ReiPatcherPlus
    ReiPatcherPlus has been replaced by Cecil.Inject and therefore is not supported anymore.
    You can, however, still get the latest version from here:
    Download (normal): Version 2.2
    Download (DEV): Version 2.2 DEV
    Last edited by denikson; 12-19-2015, 06:08 AM. Reason: Added documentation page

    Comment


    • #3
      I've found an issue with ChangeAccess. When changing the accessibility of a nested type, it assigns "IsPublic" instead of "IsNestedPublic". Which seems to result in it still not being accessible from the outside.

      Comment


      • #4
        Originally posted by hiremi View Post
        I've found an issue with ChangeAccess. When changing the accessibility of a nested type, it assigns "IsPublic" instead of "IsNestedPublic". Which seems to result in it still not being accessible from the outside.
        Pardon the late reply, but I suppose later is better than never.

        Thank you for this information. ReiPatcherPlus has been replaced by Cecil.Inject and thus there is no really a reason to support it anymore -- I suggest taking a look at Cecil.Inject instead.
        The issue should be fixed along with a bunch of new and revised methods.

        Comment


        • #5
          I see you're using LaTeX on the guide on the github page, take a look at MarkDown, since GitHub renders it to html when viewing the page. (GitHub has its own flavor, but its not that deviating from the "standard")
          Other than that good job.
          Signature Space Critical, You can find most of my links and stuff Here now.
          CM3D2: Loaders | Translation | Signboard | Body-Writing
          SBPR: Loaders

          CM3D2 HF Patch (v120.0)
          CM3D2.ToolKit - Pre Release

          Comment


          • #6
            Originally posted by usagirei View Post
            I see you're using LaTeX on the guide on the github page, take a look at MarkDown, since GitHub renders it to html when viewing the page. (GitHub has its own flavor, but its not that deviating from the "standard")
            Other than that good job.
            Thanks! Initially I didn't really intend on making the migration guide as a wiki page (either on GitHub or elsewhere), since it is really short and anything but a full guide and documentation. That, and my deep love for TeX made me choose it as the typesetter for that brief guide.

            That being said, I am going to write the full guide on the project's GitHub wiki -- and maybe provide a standalone PDF as well.

            A minor side note regarding guides, patching and GitHub: I am planning on migrating an rewriting the guides for ReiPatcher and UnityInjector to GitHub, since I don't really think the HGames wiki is *the* place for such technical topics. Specifically, I am thinking on using the UmaiUme's repositories -- that way the project won't be left totally empty, bereft of any purpose. (EDIT: Maybe not after all, as I do not have the permission in the group to do so.)
            Last edited by denikson; 10-10-2015, 08:14 AM.

            Comment


            • #7
              Originally posted by denikson View Post
              Thanks! Initially I didn't really intend on making the migration guide as a wiki page (either on GitHub or elsewhere), since it is really short and anything but a full guide and documentation. That, and my deep love for TeX made me choose it as the typesetter for that brief guide.

              That being said, I am going to write the full guide on the project's GitHub wiki -- and maybe provide a standalone PDF as well.

              A minor side note regarding guides, patching and GitHub: I am planning on migrating an rewriting the guides for ReiPatcher and UnityInjector to GitHub, since I don't really think the HGames wiki is *the* place for such technical topics. Specifically, I am thinking on using the UmaiUme's repositories -- that way the project won't be left totally empty, bereft of any purpose. (EDIT: Maybe not after all, as I do not have the permission in the group to do so.)
              Well, things go south, there's my User Page, that has a Guides section (Haven't pushed to the pages repo yet, still working on the back/frontend), i can host the files there if necessary.
              EDIT: Sneak Peek: http://i.imgur.com/u5fUCpl.png
              I'm not really fond of the GH Wiki Layout, so i rolled my own, alongside my downloads. Everything is static content, but not a single line of html written. It's all markdown and JSON.
              Last edited by usagirei; 10-11-2015, 12:16 PM.
              Signature Space Critical, You can find most of my links and stuff Here now.
              CM3D2: Loaders | Translation | Signboard | Body-Writing
              SBPR: Loaders

              CM3D2 HF Patch (v120.0)
              CM3D2.ToolKit - Pre Release

              Comment


              • #8
                Originally posted by usagirei View Post
                Well, things go south, there's my User Page, that has a Guides section (Haven't pushed to the pages repo yet, still working on the back/frontend), i can host the files there if necessary.
                EDIT: Sneak Peek: http://i.imgur.com/u5fUCpl.png
                I'm not really fond of the GH Wiki Layout, so i rolled my own, alongside my downloads. Everything is static content, but not a single line of html written. It's all markdown and JSON.
                Right! By the looks of it, I assume using GitHub Pages IS better than using the built-in wiki (given how neat and clean it actually looks in the screenshot). I might start rewriting and revising the tutorial provided on the HGames wiki to Markdown during this week then. The main goal is write it purely for ReiPatcher with Cecil; make it more generic; move the complete code out wiki and instead provide links to the example project on GitHub; and divide the wiki page into smaller, more "digestible" bits. Moreover, I suppose a basic tutorial into CIL wouldn't hurt either, but I will have to push it to the next week instead.

                I suppose you don't mind too much if I "butt in" with all this writing? Of course it would be great if all the documentation on ReiPatcher was located either on your (read: the creator's) GitHub or on UmaiUme's pages. Nevertheless, at least this way I'll gather some experience with Markdown and GitHub pages.
                Last edited by denikson; 10-11-2015, 02:13 PM.

                Comment


                • #9
                  Originally posted by denikson View Post
                  Right! By the looks of it, I assume using GitHub Pages IS better than using the built-in wiki (given how neat and clean it actually looks in the screenshot). I might start rewriting and revising the tutorial provided on the HGames wiki to Markdown during this week then. The main goal is write it purely for ReiPatcher with Cecil; make it more generic; move the complete code out wiki and instead provide links to the example project on GitHub; and divide the wiki page into smaller, more "digestible" bits. Moreover, I suppose a basic tutorial into CIL wouldn't hurt either, but I will have to push it to the next week instead.

                  I suppose you don't mind too much if I "butt in" with all this writing? Of course it would be great if all the documentation on ReiPatcher was located either on your (read: the creator's) GitHub or on UmaiUme's pages. Nevertheless, at least this way I'll gather some experience with Markdown and GitHub pages.
                  To be fair, i'm pretty sure i can link markdown files from outside my repo no problem, they don't need to reside in the gh-pages, so i could link to a file you own in a repository you manage.
                  That, or you send pull requests to the repository and i merge them into it.
                  Signature Space Critical, You can find most of my links and stuff Here now.
                  CM3D2: Loaders | Translation | Signboard | Body-Writing
                  SBPR: Loaders

                  CM3D2 HF Patch (v120.0)
                  CM3D2.ToolKit - Pre Release

                  Comment


                  • #10
                    Excuse me, but where do I have to place Mono.Cecil.Inject.dll exactly? The installation instruction is rather confusing for me.

                    Comment


                    • #11
                      In the same place as ReiPatcher.exe.

                      Comment


                      • #12
                        Originally posted by Baumkuchen View Post
                        Excuse me, but where do I have to place Mono.Cecil.Inject.dll exactly? The installation instruction is rather confusing for me.
                        I actually had the same problem, but I was able to find the Mono.Cecil.dll in the Reipatcher folder after a few minutes of looking. If the Mono.Cecil.dll is in the Reipatcher folder for you as well, that's where the Mono.Cecil.Inject.dll folder goes.

                        Comment


                        • #13
                          Originally posted by hiremi View Post
                          In the same place as ReiPatcher.exe.
                          Thanks for the clarification. I really can't make the guide any more specific than it already is -- Cecil.Inject is for Mono.Cecil (that ReiPatcher uses) and therefore must be placed beside it.

                          Never thought it would be that hard to find the DLL in ReiPatcher folder though, as the first post on ReiPatcher thread clearly shows where Mono.Cecil is.

                          Comment


                          • #14
                            Well, it's kind of a user vs. developer thing I think. As a developer, I'm paying attention to what .dll files are in which locations, because I need to make references to them or do various other things involving them for my own ends. If I was just using ReiPatcher to patch things, though, it's unlikely I would have paid attention to any of the .dll files - if I'm never *doing* anything with them, there's not much reason to pay attention to their names or natures.

                            Comment


                            • #15
                              Could you re-upload dll, please? MEGA says something about temporary error for a few hours now.

                              Comment

                              Working...
                              X