Richard Matthew

Results 32 comments of Richard Matthew

I think the issue is related to SHV. Technically SHVDN supports calling natives from game thread: https://github.com/crosire/scripthookvdotnet/blob/e0d6d3563562844a470d72dce4af0d2e609aa92a/source/core/ScriptDomain.cs#L542 As you can see, it doesn't dispatch task if you're running in main...

First you need to define the native struct, much like win32 P/Invoke, but `OutputArgument` [only allocate 24 bytes](https://github.com/crosire/scripthookvdotnet/blob/712bad29175b0bd50e2d9ae7c12086c0ec6801e8/source/scripting_v3/GTA.Native/Native.cs#L301). You need to use unsafe code and pass the pointer directly if...

> If we bump up the major version to v4, we should define InputArgument as a struct (we could make InputArgumentStruct, but that will make it inconvenient for script developers...

How about hooking `TlsGetValue` and `TlsSetValue`, redirect the them to the game thread's TEB? It should work for all tls, no need to find offset for each one. The only...

> I understand why SHVDN uses a fiber from SHV to run scripts for it. It's because that solution is way more easy than running them in its own ysc...

> I'm starting to think this issue is worth addressing even without thinking about other plugins or tools utilizing .NET code other than SHVDN. Yes , exception handling is completely...

If the native is called from a ysc script thread, TLS stuff should be handled by the game itself? Will using own native context make a difference?

Oh, that makes sense. >Looks like you can retrieve the native handler with the memory pattern for nativeInitFuncAddr though (the first function that will be called by nativeInit). You can...

> The offset for the tick function of `GtaThread` is 0x18 (not changed between b372 to b2824). This function? https://github.com/ivanmeler/OpenVHook/blob/a0b331ae28733a5b8ae3f2772308e5f2b5e10cf7/OpenVHook/Scripting/ScriptThread.cpp#L8

> > > The offset for the tick function of `GtaThread` is 0x18 (not changed between b372 to b2824). > > > > > > This function? https://github.com/ivanmeler/OpenVHook/blob/a0b331ae28733a5b8ae3f2772308e5f2b5e10cf7/OpenVHook/Scripting/ScriptThread.cpp#L8 > >...