09.04.2017, 14:40
The problem is, that the log core uses a function (GetNativeParamsPtr) to get the parameters pointer which was passed to a native function. Parameters are always pushed onto the stack, that's why that helper function correctly returns the native functions parameters array.
However, natives invoked through sampgdk's InvokeNative function don't push the passed parameters onto the stack, but on the heap. Don't ask me why, but I guess Zeex had a good reason to do this.
A proper solution would be to pass the params pointer directly to the log core instead of retrieving it implicitly. However, this would involve an API change, which in turn would force me to release updates to 3 different plugins. I'll probably commit the fix, but I won't do the releases, since I don't have the time for that.
You'd also just have to disable debug logging, as this bug only impacts native-call logging, which is only enabled when debug logging is enabled.
Regarding the callbacks: that AMX validation is there in case someone sends a threaded query, which takes very long to execute, from within a filterscript and unloads that filterscript while it's still executing. The AMX structure associated with that callback is now invalid, but it's still stored in the internal MySQL plugin callback structures to call the callback when that query finishes. To make sure the plugin doesn't use that invalid AMX instance, I keep a list of valid AMX instances passed by the AmxLoad/AmxUnload callbacks.
I won't add a function to manually add a AMX instance to that list, since this is more of a hack than a proper solution. I don't see a good solution to this problem here, I'm open for any suggestions though.
As I said in the sampgdk thread, I'd really suggest you incorporate the plugin source into your project. You only have to copy all the source files minus some unnecessary ones (main.cpp, CCallback.*, CDispatcher.*, COrm.*, natives.*, sdk.hpp, version.hpp.in), (maybe) remove some include directives, add the Boost headers to your include path (no need to compile the whole Boost library!) and link with the MySQL C connector. If you want to use the log core, you'd have to link to it too (you can download the developer package of the log core on GitHub). You could then use the logging functionality in your gamemode for your systems too. Write me a PM if you get stuck somewhere or need more detailed instructions on specific things.
However, natives invoked through sampgdk's InvokeNative function don't push the passed parameters onto the stack, but on the heap. Don't ask me why, but I guess Zeex had a good reason to do this.
A proper solution would be to pass the params pointer directly to the log core instead of retrieving it implicitly. However, this would involve an API change, which in turn would force me to release updates to 3 different plugins. I'll probably commit the fix, but I won't do the releases, since I don't have the time for that.
You'd also just have to disable debug logging, as this bug only impacts native-call logging, which is only enabled when debug logging is enabled.
Regarding the callbacks: that AMX validation is there in case someone sends a threaded query, which takes very long to execute, from within a filterscript and unloads that filterscript while it's still executing. The AMX structure associated with that callback is now invalid, but it's still stored in the internal MySQL plugin callback structures to call the callback when that query finishes. To make sure the plugin doesn't use that invalid AMX instance, I keep a list of valid AMX instances passed by the AmxLoad/AmxUnload callbacks.
I won't add a function to manually add a AMX instance to that list, since this is more of a hack than a proper solution. I don't see a good solution to this problem here, I'm open for any suggestions though.
As I said in the sampgdk thread, I'd really suggest you incorporate the plugin source into your project. You only have to copy all the source files minus some unnecessary ones (main.cpp, CCallback.*, CDispatcher.*, COrm.*, natives.*, sdk.hpp, version.hpp.in), (maybe) remove some include directives, add the Boost headers to your include path (no need to compile the whole Boost library!) and link with the MySQL C connector. If you want to use the log core, you'd have to link to it too (you can download the developer package of the log core on GitHub). You could then use the logging functionality in your gamemode for your systems too. Write me a PM if you get stuck somewhere or need more detailed instructions on specific things.