pawn-lang/YSI

Too many hooks?

Chaprnks opened this issue · 11 comments

I've been working on this roleplay project for almost a decade. By now I have over 400 .pwn modules that all use y_hooks. It seems that as soon as I uncomment the mappings (each map has its own .pwn & hooks), I get a YSI error on script init.

" YSI Warning: Hooks_GetAllHooks: Potential overflow."

gstzlme

So increase them.

Where exactly is the definition for the maximum number of hooks? Been searching around the YSI library, but can't seem to find the definition.

Ok, I thought there was a define for this - turns out there isn't:

https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Coding/y_hooks/y_hooks_impl.inc#L547

The problem is there - the system is limited to 128 hooks of the same callback, but apparently this is a hard-coded limit, which is very bad coding on my part! If you can abstract that to a MAX_SINGLE_CALLBACK_HOOKS define (but make the default like 32 in that case since it won't need to be huge to cover all cases (which it apparently didn't anyway)), could you make a pull request with the modification please?

I can't seem to get YSI 5 to be compatible with my script (still using YSI 4 at the moment). Here's the errors I get when I try upgrading to YSI 5 (with the same exact code compiling fine in YSI 4).

btzzdsn

Those just mean you have global symbols with awful generic names. I suggest prefixing variables with g_ and enums with E_ or e_ depending on type.

I figured that would be it.. might as well rename all my includes (gonna become a problem in the future anyways).

As I was renaming some includes, I noticed that YSI 5 has Iter_Contains removed.. Is there an equivalent function to use in the YSI 5 y_iterate?

It actually was an issue with the compiler! I switched to the compiler on your other repo & all the preceding variable warnings dissapeared!

The problem is there - the system is limited to 128 hooks of the same callback, but apparently this is a hard-coded limit, which is very bad coding on my part! If you can abstract that to a MAX_SINGLE_CALLBACK_HOOKS define (but make the default like 32 in that case since it won't need to be huge to cover all cases (which it apparently didn't anyway)), could you make a pull request with the modification please?

pawn-lang/YSI-Includes#314

;)

The code finally compiles now, but testing it out is a whole different story. It seems like all the hooks are processing correctly.. but the original public's in the end of the script are completely ignored. Has the ALS definition system changed since YSI 4? It may be some of the ALS defines that aren't being called properly.

Also, I've noticed that in YSI 4, I was only able to get the script running properly with "_YSI_PLUGINS_FIXES_2". Is this the same for YSI 5? I noticed there are also y_timers_v4 & y_timers_v5; are either of those in working states?

ALS hasn't changed, something could be broken but I can't say what without an example.

Stick with a working version of y_timers you know for now.

Unfortunately after a bunch of debugging & commenting out / recompiling; I'm left with no other option than to branch the YSI 5 & revert back to the YSI 4. Each time it would have some odd compiler issue, or simply just bug out when I join the server (like it'll just say connected, but won't spawn me). I also noticed that with YSI 5, the server doesn't respond to queries, but 4 it does.

If your interested, I'd like to get to the bottom of this. Maybe we can chat via Discord or TeamViewer, so you can get a better idea of what's going on. Once I can get this 5.x working with the script; I'll be contributing to the YSI repository on a daily basis (I have over 1300 commits in the last few months on my current project, just to give you an idea of how active I usually code).

Yes, I'd love to get some input and debugging from a real-world project. It is a fairly big under the hood change, and I didn't think the migration would be perfect first time. So thank you for putting up with the issues thus far!