SRL Archive - S.M.A.R.T.

Addition to SMART:


Nava2

2010-03-07 16:11:03

Index: src/Main.cpp
===================================================================
--- src/Main.cpp (revision 6)
+++ src/Main.cpp (working copy)
@@ -28,12 +28,17 @@

#include <dlfcn.h>

-#define NumExports 68
+#define NumExports 72

static char* exports[] = {
(char*)"setup", (char*)"procedure SmartSetup(root, params: String; width, height: Integer);",
+ (char*)"setupEx", (char*)"procedure SmartSetupEx(root: String; isMembers, isSigned, isHighDef: boolean; width, height: Integer);",
(char*)"getImageArray", (char*)"function SmartImageArray(): Pointer;",
(char*)"getDebugArray", (char*)"function SmartDebugArray(): Pointer;",
+ (char*)"getServer", (char*)"function SmartGetServer(): integer;",
+ (char*)"isMembersClient", (char*)"function SmartIsMembersClient(): boolean;",
+ (char*)"isSignedClient", (char*)"function SmartIsSignedClient(): boolean;",
+ (char*)"isHighDefClient", (char*)"function SmartIsHighDefClient(): boolean;",
(char*)"getRefresh", (char*)"function SmartGetRefresh: integer;",
(char*)"setRefresh", (char*)"procedure SmartSetRefresh(x: integer);",
(char*)"setDebugColor", (char*)"procedure SmartSetTrasparentColor(color: integer);",
@@ -136,7 +141,7 @@

#include <windows.h>

-#define NumExports 70
+#define NumExports 71

static char* exports[] = {
(char*)"setup@16", (char*)"procedure SmartSetup(root, params: String; width, height: Integer);",
@@ -144,6 +149,7 @@
(char*)"getDebugHDC@0", (char*)"function SmartGetDebugDC: integer;",
(char*)"getImageArray@0", (char*)"function SmartImageArray(): integer;",
(char*)"getDebugArray@0", (char*)"function SmartDebugArray(): integer;",
+ (char*)"getServer@0", (char*)"function SmartGetServer(): integer;",
(char*)"getRefresh@0", (char*)"function SmartGetRefresh: integer;",
(char*)"setRefresh@4", (char*)"procedure SmartSetRefresh(x: integer);",
(char*)"setDebugColor@4", (char*)"procedure SmartSetTrasparentColor(color: integer);",
Index: src/Smart.cpp
===================================================================
--- src/Smart.cpp (revision 6)
+++ src/Smart.cpp (working copy)
@@ -49,6 +49,9 @@
JSTRING _string;

char* curserver = 0;
+bool membersClient = false;
+bool signedClient = false;
+bool highDefClient = false;
PRGB image = 0;
PRGB debug = 0;

@@ -75,6 +78,23 @@
return (long) debug;
}

+// get server loaded information
+char* getServerPrefix() {
+ return curserver;
+}
+
+bool isMembersClient() {
+ return membersClient;
+}
+
+bool isSignedClient() {
+ return signedClient;
+}
+
+bool isHighDefClient() {
+ return highDefClient;
+}
+
void setDebugColor(jint color) {
if (jre) jre->SetIntField(smart, _client.transcolor, color);
}
@@ -204,6 +224,19 @@
unloadClasses();
}

+void setupEx(char* _root, bool _members, bool _signed, bool _highDef, long _width, long _height) {
+ membersClient = _members;
+ signedClient = _signed;
+ highDefClient = _highDef;
+ string params = "plugin.js?param=o0,a";
+ char* tempStr;
+ strcat(params, sprintf(tempStr, "%d", (_signed ? 0 : 1) * (_highDef && _signed ? 0 : 1));
+ strcat(params, ",m");
+ strcat(params, sprintf(tempStr, "%d", (_members ? 1 : 0));
+ setup(_root, params, _width, _height);
+}
+
+
void setup(char* root, char* params, long width, long height) {
cout << "SmartSetup Entered\n";
if (jre) vm->AttachCurrentThreadAsDaemon((void**)&jre, 0);

This is small, but it allows external scripters to read what information is loaded by the client.

The new SMART setup also stores these values.

Remember, this is my *first* time using cpp, so bear in mind, my standards may be off, and I actually can't compile this so I don't know if it even works.. I need to setup my cpp to compile 32bit.

<3 you benlaand.

E: uploaded the two files I changed.
E2: I just noticed, the exports num for linux needs to be incremented one, as well the windows exports aren't right, I don't fully understand C string structure.

Main

2010-03-08 15:23:10

So script can get info off smart client?

Nava2

2010-03-08 19:07:46

More SRL than a script, but yes, it does allow a scripter to do that.

FEAR

2010-03-09 03:55:06

From: Nava2
More SRL than a script, but yes, it does allow a scripter to do that.


So it will be something like reflection? :confused: SRL can 'read' whats on the client and tell SCAR/Simba to do stuff based on that?

Nava2

2010-03-09 08:14:52

No, you are confused.

All this is for is seeing what client SMART currently has loaded.

marpis

2010-03-09 09:04:39

From: Nava2
No, you are confused.

All this is for is seeing what client SMART currently has loaded.


In what form is the output? o_O I mean the inspected loaded data.
E: Oh, I see… at first I thought you could inspect all the data that has been loaded with SMART, like the rs client and everything, that confused me :p

Nava2

2010-03-09 14:44:19

Nah, its literally, just get the params you passed back. Nothing special..

I might fix it up to just save the `param' string and the root string. Might be easier.. Cleaner too.