-
Notifications
You must be signed in to change notification settings - Fork 13
Allow launching multiple instances without BunnymodXT #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Isn't this function called for every single hooked pointer? Doesn't seem appropriate to do this here |
|
You are absolutely right -- your assertion correctly points out implementation inefficiency from my part! Anyway, fixed. Interesting that |
src/hooks/engine.rs
Outdated
| let mutex = OpenMutexW( | ||
| SYNCHRONIZE, | ||
| 0, | ||
| to_wide("ValveHalfLifeLauncherMutex").as_ptr(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this will drop the Vec before it gets passed into a function, leading to a use after free
Also while we're at it could you extract all this into a separate function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmmm, I thought compiler would just create a constant string during compilation. rust-analyzer didn't complain and it works. This code is copied from my other project and that also works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean maybe it could be optimized but here you're allocating a new Vec<> that you're returning from a function, getting its .as_ptr(), then instantly dropping the Vec, and passing the now-stale ptr into the function. If you try that with CString::new() I think they even added a warning/error for this
But BXT uses A? https://github.com/YaLTeR/BunnymodXT/blob/eec19bf169f77b813724118c9c4b009fdecb4077/BunnymodXT/helper_functions.hpp#L23 |
|
Yes it does. I am still not sure why but when I use |
|
Weird and unfortunate to have that vector but alright ty |
Make it easier for people to use just bxt-rs.
One incidental good usage of BunnymodXT is that it always "focuses" on the game when the game is not in focus, meaning no FPS drop. BXT also allows launching multiple instances. With those two combined, a streaming setup containing multiple views of the game.
This should be included in bxt-rs as some of the more features (for spectating) I recently developed for are only on bxt-rs.