- Current release is here
Syphonize an application at runtime
Ever wished that a random opengl application would serve its frames via Syphon? Well, now you can make that happen!
What is this?
SyphonInject is a OSX utility that uses Scripting Additions or mach_inject, mach_override and JRSwizzle to insert a Syphon server into a running process. It'll only work for applications that are doing OpenGL based rendering.
How does it work?
I'll leave the details of mach_inject/override and ObjC metthod Swizzling to your own research. There lies dragons etc. Once the SyphonInject bundle is injected into the target process it takes over all calls to CGLRefreshDrawable and -[NSOpenGLContext flushBuffer]. When those are called it copies the OpenGL front buffer to a syphon server and publishes the frame. The Injector prefers to use NSOpenGLContext, as there's some stuff related to fullscreen applications that don't work as well from CGLRefreshDrawable (related to the size of the window).
Hopefully nothing. That said, you're injecting random code into some process. Things could blow up, the NSA could show up. Who knows.
If the application has two OpenGL windows or for some reason maintains multiple contexts things are going to go all sideways quickly. It handles the case where an application uses a different context when fullscreen vs windowed (only one thing I've tested so far did that) so if the contexts are actually different it's just going to keep swapping between them constantly. That probably isn't what you want.
How do I use it?
First: Install the pkg. This installs the SyphonInject application and the Scripting Addition bundle. The Scripting Addition is installed into /Library/ScriptingAdditions
Once this is done launch SyphonInject. You'll see a list of processes, select the one (or multiple..) you want and click the "Inject" button. That's it.
The syphon server will start up as soon as you inject the code into the process. Ok, technically it starts on the next call to the overridden functions, but that's close enough.
If the process doesn't do any OpenGL rendering nothing will happen.
How do I stop it?
Quit the application you injected the server into. Once it is injected it cannot be stopped.
4521e0351a - Aug 13 2013