Git Product home page Git Product logo

Comments (11)

praydog avatar praydog commented on June 12, 2024

Unable to replicate. I'm reworking how the hooks work internally though.

from reframework.

sigve10 avatar sigve10 commented on June 12, 2024

Is it a work in progress change or has it been included in the latest release, nightly or otherwise? I'd be happy to test it again whenever the hook rework is available.

from reframework.

praydog avatar praydog commented on June 12, 2024

I've pushed my changes for the hooks.

However, I could see this still happening if you're hooking one function, and then calling getSkillData from within the hook, while it's already hooked. Were you doing this previously?

from reframework.

sigve10 avatar sigve10 commented on June 12, 2024

No, not at all. As mentioned, the freeze occurs for me even without any logic within the hook. I'll test it again tomorrow morning with the new changes.

Granted it's not reproducible though, it might be related to the fact that it's part of a pretty massive project, which already contains a ton of different hooks and functions. I doubt there's a correlation, but maybe there's something in that.

I'll tell you how it goes.

EDIT: Oh wait, I suppose you mean first hooking onto a different function which calls getSkillData in addition to having hooked that function. My mind had immediately hopped to accidental recursion into stack overflowing. I suppose there's a chance I've made a combo like that; As I said, it's a huge and diverse project, so it's not unlikely there's something like that in there somewhere.

from reframework.

sigve10 avatar sigve10 commented on June 12, 2024

Seems to work properly with the newest version.

Now, I've had some issues in the past where hooks and such would stop working even through game restarts due to some kind of system instability of sorts (I genuinely have no clue either), and those issues would be solved by system restarts. Seeing as how I was testing this on a different system, I gave it a shot with the old version as well in order to see if it wasn't system specific, and sure enough: it did freeze on this system as well. So, that means the new hook system did in fact fix something, so thanks a lot for looking into it! 🎉

from reframework.

praydog avatar praydog commented on June 12, 2024

I should mention that these changes have removed the guarantee between pre and post that the entire hook will be locked down across threads. Meaning that saving some of the args to use in post may break now if it's a method called on multiple threads.

I'm still playing around with this and thinking of possible solutions that won't break old scripts that were relying on this guarantee.

from reframework.

praydog avatar praydog commented on June 12, 2024

Nightly release will have a thread API for those instances where you absolutely need something you can only get in the pre hook but need to use it in the post hook for some reason. Many cases this may not matter, but to be absolutely correct, then use the thread API, like this:

local pawn_t = sdk.find_type_definition("app.Pawn")

sdk.hook(
    pawn_t:get_method("updateMove"),
    function(args)
        local storage = thread.get_hook_storage()
        storage["this"] = sdk.to_managed_object(args[2])
    end,
    function(retval)
        local this = thread.get_hook_storage()["this"]
        print("this: " .. tostring(this:get_type_definition():get_full_name()))
        return retval
    end
)

This is only necessary if the hooked function seems to be getting called very frequently, and from multiple threads.

Docs: https://cursey.github.io/reframework-book/api/thread.html

from reframework.

praydog avatar praydog commented on June 12, 2024

381c677 should be the final commit that resolves any issues with the new hooking system. Let me know if these new changes still work as intended.

from reframework.

sigve10 avatar sigve10 commented on June 12, 2024

I'll check it as soon as I have time. Thanks for your hard work! I take it this will become a main branch feature at some point?

from reframework.

praydog avatar praydog commented on June 12, 2024

It already is on master branch. Unless you mean uploaded to Nexus, then sure. I'm pretty busy with working on the C# API and Dragon's Dogma 2 so don't know when that will happen.

from reframework.

sigve10 avatar sigve10 commented on June 12, 2024

Ah, I meant the master branch, but it would also be neat to have it on nexus so that people won't have too much trouble getting their hands on it, but there's no haste. The mod won't be out for at least a few months, so it can wait until you have more time on your hands.

I've also gotten to test things now, and I'm glad to see that the whole hook args thing isn't as breaking as it sounded. I'll still upgrade my old functions to use the new thread storage, but it's nice to see that my old mods likely won't be affected.
Again, thanks for your hard work!

from reframework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.