BenLand100
2012-07-13 00:08:59
So, I did some playing around with SMART and it turns out I can get it to run in the other rendering modes, but only when Java is started as it's own process, i.e. not starting the JVM manually via JNI. I successfully got the client to enter Safe Mode, Software, and OpenGL. THAT BEING SAID, Software and OpenGL are both rather useless for the main feature of SMART: minimizing.
First, a bit about how SMART currently works:
When you load the client, you have the initial java.awt.Applet, which does no rendering, and you have a single component in that applet: an RS-specific subclass of java.awt.Canvas where literally everything is rendered and events are processed. In current versions of SMART, I replace the java.awt.Graphics object returned by the getGraphics() method of that canvas with the java.awt.Graphics object of a java.awt.image.BufferedImage, effectively forcing the client to render to that buffer regardless of where it is on the screen, minimized or not. This was designed 6 or so years ago when there was only one rendering mode (the equivalent of Safe Mode now).
Here's what I've found out about the (modern) client:
Basically, you all know there are three main rendering modes: SafeMode, Software, and OpenGL. So the question you're all dying to ask is: why does SMART only work with Safe Mode? The answer is simple: Safe Mode seems to be the only mode that uses Java's rendering framework (the one built into AWT), and hence it's the only one SMART can intercept java-side. As far as I can tell, Software mode renders to the canvas surface, but not from within java. I suspect that they do the rendering using the native-rendering functionality of AWT such that there's no chance for me to intercept the data before it gets to the screen. The end result is that there's nothing I can do to give Simba the color data, however Simba can still scrape the colors off the screen in the traditional manner. That only leaves OpenGL, which is similarly useless as far as SMART is concerned, but further, the rendering is done on the GPU and in the video ram such that it never touches a place I can get the color data from. (Or Simba, for that matter, on Windows, at least. Linux seems to have functionality to get around this.)
How I know this:
Well, for the most part, this is a mixture of fact and educated guesses. I know Safe Mode works and I know why it works. I know Software and OpenGL don't work in the same way, even though I'm positive they are rendering to the same java.awt.Canvas. That is to say, I can still replace the java.awt.Graphics object, but it is not receiving the rendering data and hence Simba would be flying blind in those modes. With software mode enabled there is a horrible flicker of SMART drawing it's buffer to the screen and RS rendering directly to the screen, so that tells me the rendering is still in normal memory using native drawing techniques. For OpenGL there is no flicker, meaning that the video card is completely overwriting that portion outside of regular ram as it is drawn to the screen, hence untouchable.
What it all means:
Basically, if Safe Mode ever goes away, either it's back to browser with mouse/keyboard stealing, or SMART will have to remain visible and you will still have your mouse and keyboard free. Arguably a step down after six years of minimize-and-forget. That being said, there might be hope for OpenGL since I have stumbled upon functionality to grab color data from an OpenGL rendering. I don't know fully how to implement it, but perhaps someone working with OGL 'interception' knows a way to grab a copy of the screen. IFF this works when the program is minimized (it potentially could) then OGL could be a viable solution to the problem.
That being said (and the real reason I wrote all this down) SMART will require a rather major overhaul to get OpenGL or Software mode working as a Simba plugin. It's not something I'm willing to do 1) without assurance that OGL is a viable alternative when minimized OR 2) as long as Safe Mode still exists (I believe Jagex is going to fix the graphical bugs, but I may be proven wrong). If safe mode goes away, I'll make it where SMART provides silent mouse/keyboard but no longer minimizable functionality.
That is all, hope you enjoyed.
First, a bit about how SMART currently works:
When you load the client, you have the initial java.awt.Applet, which does no rendering, and you have a single component in that applet: an RS-specific subclass of java.awt.Canvas where literally everything is rendered and events are processed. In current versions of SMART, I replace the java.awt.Graphics object returned by the getGraphics() method of that canvas with the java.awt.Graphics object of a java.awt.image.BufferedImage, effectively forcing the client to render to that buffer regardless of where it is on the screen, minimized or not. This was designed 6 or so years ago when there was only one rendering mode (the equivalent of Safe Mode now).
Here's what I've found out about the (modern) client:
Basically, you all know there are three main rendering modes: SafeMode, Software, and OpenGL. So the question you're all dying to ask is: why does SMART only work with Safe Mode? The answer is simple: Safe Mode seems to be the only mode that uses Java's rendering framework (the one built into AWT), and hence it's the only one SMART can intercept java-side. As far as I can tell, Software mode renders to the canvas surface, but not from within java. I suspect that they do the rendering using the native-rendering functionality of AWT such that there's no chance for me to intercept the data before it gets to the screen. The end result is that there's nothing I can do to give Simba the color data, however Simba can still scrape the colors off the screen in the traditional manner. That only leaves OpenGL, which is similarly useless as far as SMART is concerned, but further, the rendering is done on the GPU and in the video ram such that it never touches a place I can get the color data from. (Or Simba, for that matter, on Windows, at least. Linux seems to have functionality to get around this.)
How I know this:
Well, for the most part, this is a mixture of fact and educated guesses. I know Safe Mode works and I know why it works. I know Software and OpenGL don't work in the same way, even though I'm positive they are rendering to the same java.awt.Canvas. That is to say, I can still replace the java.awt.Graphics object, but it is not receiving the rendering data and hence Simba would be flying blind in those modes. With software mode enabled there is a horrible flicker of SMART drawing it's buffer to the screen and RS rendering directly to the screen, so that tells me the rendering is still in normal memory using native drawing techniques. For OpenGL there is no flicker, meaning that the video card is completely overwriting that portion outside of regular ram as it is drawn to the screen, hence untouchable.
What it all means:
Basically, if Safe Mode ever goes away, either it's back to browser with mouse/keyboard stealing, or SMART will have to remain visible and you will still have your mouse and keyboard free. Arguably a step down after six years of minimize-and-forget. That being said, there might be hope for OpenGL since I have stumbled upon functionality to grab color data from an OpenGL rendering. I don't know fully how to implement it, but perhaps someone working with OGL 'interception' knows a way to grab a copy of the screen. IFF this works when the program is minimized (it potentially could) then OGL could be a viable solution to the problem.
That being said (and the real reason I wrote all this down) SMART will require a rather major overhaul to get OpenGL or Software mode working as a Simba plugin. It's not something I'm willing to do 1) without assurance that OGL is a viable alternative when minimized OR 2) as long as Safe Mode still exists (I believe Jagex is going to fix the graphical bugs, but I may be proven wrong). If safe mode goes away, I'll make it where SMART provides silent mouse/keyboard but no longer minimizable functionality.
That is all, hope you enjoyed.