willox / auxtools

Rust library for low-level interfacing with BYOND's virtual machine. Includes a remote debugger for the BYOND DreamMaker language.
MIT License
27 stars 32 forks source link

Ports maptick from extools #22

Closed Elinvynia closed 3 years ago

Elinvynia commented 3 years ago

This currently does not compile (had some issues with the #[hook] proc macro.

Unfortunately seems like I'm a little late on this, regardless, I'm posting it as a draft in case anything I did is helpful, and so I can learn how this could have been done.

willox commented 3 years ago

I like this approach more than https://github.com/willox/auxtools/pull/21 because it doesn't jump back and forth between C++/Rust quite so much.

Sadly, maptick doesn't belong in auxtools but in some separate project that depends on auxtools. My intention was for it to live in https://github.com/willox/auxtools_tg.

The reason we need is separate like that is because BYOND instances are currently able to load multiple modules that use auxtools (a common use-case for this would probably be auxtools_tg and the debug server being loaded at the same time.) If maptick lives in auxtools, it'd mean having the code running more than once per send_maps call.

The same reason probably applies for why you are struggling to use the hook macro - it is intended for consumers of auxtools and not auxtools itself.

Putnam3145 commented 3 years ago

Is send_maps an actual proc? I was under the impression it was more internal, which is why I was so C++-focused in my own approach, essentially just copying how the call_proc_by_id and runtime hooks were doing it.

Elinvynia commented 3 years ago

Is send_maps an actual proc? I was under the impression it was more internal, which is why I was so C++-focused in my own approach, essentially just copying how the call_proc_by_id and runtime hooks were doing it.

Honestly I don't know much about the internals of BYOND, this was just my naive approach at it (using my somewhat better Rust knowledge) and I've been asked by a few folks to do so. Seems like you are more knowledgeable than me in this area, so if my work helped you in any way, feel free to use that knowledge!

Sadly, maptick doesn't belong in auxtools but in some separate project that depends on auxtools. My intention was for it to live in https://github.com/willox/auxtools_tg.

Thanks for the information! Guess I'll close this then.