PDA

View Full Version : OpenGL.



Brandon
07-13-2012, 07:44 AM
UPDATED: August 9th 2012.


PROPER Location of Text Rendering coming soon (HOPEFULLY). VertexBuffer Hook coming soon (HOPEFULLY). This will allow me to grab the actual vertices rather than vertex #0. That way I can click objects even if only 1 pixel of it is showing. Atm, it clicks dead center of an object unless you specify the offset vertex.
I plan to use Base 36 for ID's to shorten them. Well maybe only on the Simba side. Probably leave it as Base 10 on the C++ side.





https://github.com/Brandon-T/GLHook

While reading below, you'll realize I said I have trouble with Triangle Enumeration and 3D Programming math.. This is an updated Edit: http://www.arcsynthesis.org/gltut/Basics/Introduction.html

That's where I'm learning the math to build on this foundation.. I already know calculus and stuff but this is some next level crap.

Note: The github only contains the basic layout.. It doesn't contain the most updated version so it doesn't reflect how far I got but meh that's ok for now.
I guess now is about the right time to tell the world I was working on the OpenGL hooking.. Since SRL is down, everyone is looking at alternatives and I guess I'll start showing one too. Mato has DirectX I have OpenGL. I'm not taking anything away from him. He is a brilliant fellow and I hope he continues without rushing. I may or may not finish or continue this but here is a brief explanation of how the shit works right now.

First I used "DLLExport Viewer x64" to figure out what Jagex's OGL has compared to the one in my System32/SysWOW64.

They use a library/DLL called Corona for imaging, etc.. I saved a list of all exported functions from Jagex's DLL and with the same program saved a list with the one on my system. With a little reading I learned to Detour Functions and Inject by writing to process memory. Both of which I provided in the GitLink.

A detour function is a function that has the exact same syntax as the original function. Aka the one we are trying to hook.

So lets say OpenGL.dll has one that looks like: void glBegin(GLEnum mode);
Our Detour would look like GLHook_glBegin(GLEnum mode);

Now what does that have to do with anything.. well here is some sample code:

GLHook_glBegin(GLEnum mode)
{
//Do whatever we want in here.. then below, we pass the parameters to the original function.
(*optr_glBegin(mode);
}


In our detour, we are getting the client's data FIRST! Then we pass it to the OpenGL32.dll in our system folder. That *optr_glBegin is a function pointer to the original OpenGL32.dll in sys32.

Now that that's clear, the next thing I did was learn what each function does. I did this by reading through the entire MSDN database on OpenGL functions :c Yes I know.. a lot of reading and shit.

When I saw how many functions there were to write, I gave up and wrote function generator which looks like:


//#define _WIN32_WINNT 0x0403
#include <windows.h>
#include <iostream>
#include "Functions.hpp"
#include "Strings.hpp"

using namespace std;

StringArray GLTypes = StringArray("GLint ", "GLuint ", "GLenum ", "GLfloat ", "GLclampf ",
"GLsizei ", "GLboolean ", "GLubyte ", "GLvoid ", "const ",
"GLbitfield ", "GLclampd ", "GLdouble ", "GLshort ", "GLbyte",
"GLushort ", "GLclampi ", "GLbitfield ", "void", "HDC ", "DWORD ",
"LPGLYPHMETRICSFLOAT ", "FLOAT ", "DOUBLE ", "UINT", "INT ", "float ",
"double ", "int ", "LPCSTR ", "LPSTR ", "LPTSTR ", "LPCTSTR ", "LPLAYERPLANEDESCRIPTOR ",
"LPPIXELFORMATDESCRIPTOR", "PIXELFORMATDESCRIPTOR ", "HGLRC ", "COLORREF ", "BOOL ", "*",
"**");

void CreateGLFunctionsFromTypedefs()
{
StringArray FileContents;
ifstream File("C:/Users/Brandon/Desktop/OGL Editing/GLTypedefs.hpp", std::ios::in);
if (File.is_open())
{
string Line;
while (getline(File, Line))
FileContents(Line);
File.close();
}

string Temp = string();
string FuncType = string();
string PtrStr = string();
string Final = string();
ReplacementFlags FalseFlags = ReplacementFlags(false, false);

for (size_t I = 0; I < FileContents.Size(); I++)
{
if ((FileContents[I][0] == 't') && (FileContents[I][1] == 'y'))
{
FuncType = Copy(FileContents[I], 9, Pos("(WINAPI", FileContents[I], 9) - 9);
Temp = Replace(FileContents[I], "typedef ", "", FalseFlags);
Temp = Replace(Temp, "(WINAPI *ptr_", "", FalseFlags);
PtrStr = Replace(Temp, ";", "", FalseFlags);
PtrStr = Copy(PtrStr, Pos(" ", PtrStr, 0) + 2, PtrStr.end() - (PtrStr.begin() + Pos(" ", PtrStr, 0)) + 2);
Temp = Replace(Temp, ";", "\n{\n\t", FalseFlags);
Temp = Replace(Temp, ") (", "(", FalseFlags);
PtrStr = ((FuncType[0] == 'c' && FuncType[1] == 'o') && (PtrStr[0] == 'G' && PtrStr[1] == 'L')) ? Copy(PtrStr, Pos(" ", PtrStr, 0) + 2, PtrStr.end() - PtrStr.begin() - 2) : PtrStr;
Temp = (FuncType[0] == 'c' && FuncType[1] == 'o') ? Replace(Temp, " gl", " GLHook_gl", FalseFlags) : Replace(Temp, " ", " GLHook_", FalseFlags);
Temp = "GL_EXPORT __stdcall " + Temp; //__stdcall added.

for (size_t J = 0; J < GLTypes.Size(); J++)
{
PtrStr = Replace(PtrStr, GLTypes[J], "", ReplacementFlags(true, false));
PtrStr = Replace(PtrStr, "*params", "params", ReplacementFlags(true, false));
}
PtrStr = "(*optr_" + PtrStr + ";";
PtrStr = ((FuncType != "void") ? "return " : "") + PtrStr;
Temp += PtrStr + "\n}\n\n";
Final += Temp;
}
}
WriteFile("C:/Users/Brandon/Desktop/OGL Editing/GLFunctions.hpp", Final);
}

void CreateGLAddressesFromDefinitions()
{
StringArray FileContents;
ifstream File("C:/Users/Brandon/Desktop/OGL Editing/GLHook.def", std::ios::in);
if (File.is_open())
{
string Line;
while (getline(File, Line))
FileContents(Line);
File.close();
}

string Final = string();
for (size_t I = 0; I < FileContents.Size(); I++)
{
if ((FileContents[I][0] != ';' ) && (Pos("LIBRARY", FileContents[I], 0) == -1) && (Pos("DESCRIPTION", FileContents[I], 0) == -1) && (Pos("EXPORTS", FileContents[I], 0) == -1))
{
StringArray Split = SplitString(FileContents[I], "= ");
for (size_t J = 0; J < Split.Size(); J++)
{
//if (Split[J][0] != 'G' && Split[J][1] != 'L' && Split[J][2] != 'H' && Split[J][3] != 'O' && Split[J][4] != 'O' && Split[J][5] != 'K')
if (Pos("GLHook", Split[J], 0) == -1)
{
//Final += "MessageBox(NULL, \"" + Split[J] + "\", \"CrashReport\", 0);\n";
Final += "if ((optr_" + Split[J] + " = (ptr_" + Split[J] + ") GetProcAddress(OriginalGL, \"" + Split[J];
Final += "\")) == NULL)\n{\n\treturn false;\n}\n\n";

//Final += "\")) == NULL)\n{\n\t";
//Final += "MessageBox(NULL, \"" + Split[J] + "\", \"CrashReport\", 0);\n\t";
//Final += "return false;\n}\n\n";
}
}
}
}
WriteFile("C:/Users/Brandon/Desktop/OGL Editing/GLProcAddresses.hpp", Final);
}

void CreateGLExternsFromTypedefs()
{
StringArray FileContents;
ifstream File("C:/Users/Brandon/Desktop/OGL Editing/GLTypedefs.hpp", std::ios::in);
if (File.is_open())
{
string Line;
while (getline(File, Line))
FileContents(Line);
File.close();
}

string Temp = string();
string Final = string();
for (size_t I = 0; I < FileContents.Size(); I++)
{
int Position = Pos("*ptr_", FileContents[I], 0) + 5;
if (FileContents[I][0] == 't' && FileContents[I][1] == 'y')
{
Temp = Copy(FileContents[I], Position + 1, Pos(") ", FileContents[I], Position) - Position);
Final += "extern ptr_" + Pad(Temp, 27, " ", false) + "optr_" + Temp + ";\n";
}
else
{
Final += FileContents[I] + "\n";
Final = Replace(Final, "TYPEDEFS", "NAMING", ReplacementFlags(false, false));
}
}
WriteFile("C:/Users/Brandon/Desktop/OGL Editing/GLExterns.hpp", Final);
}

void CreateGLDefinitionsFromTypedefs()
{
StringArray FileContents;
ifstream File("C:/Users/Brandon/Desktop/OGL Editing/GLTypedefs.hpp", std::ios::in);
if (File.is_open())
{
string Line;
while (getline(File, Line))
FileContents(Line);
File.close();
}

string Temp = string();
string Final = string();

Final += "; @Author : Brandon T.\n";
Final += ";\n";
Final += "; @param : GLHook Definition File.\n";
Final += "; @param : Info From MSDN Documentation.\n\n\n";
Final += "LIBRARY GLHook\n";
Final += "DESCRIPTION \"GLHook Definition File\"\n";
Final += "EXPORTS\n\n";

for (size_t I = 0; I < FileContents.Size(); I++)
{
int Position = Pos("*ptr_", FileContents[I], 0) + 5;
if (FileContents[I][0] == 't' && FileContents[I][1] == 'y')
{
Temp = Copy(FileContents[I], Position + 1, Pos(") ", FileContents[I], Position) - Position);
Final += Pad(Temp, 27, " ", false) + "= GLHook_" + Temp + ";\n";
}
}
WriteFile("C:/Users/Brandon/Desktop/OGL Editing/GLHook.def", Final);
}

void CreateGLNamingListFromExterns()
{
StringArray FileContents;
ifstream File("C:/Users/Brandon/Desktop/OGL Editing/GLExterns.hpp", std::ios::in);
if (File.is_open())
{
string Line;
while (getline(File, Line))
FileContents(Line);
File.close();
}

string Final = string();
for (size_t I = 0; I < FileContents.Size(); I++)
{
if (FileContents[I][0] == 'e')
Final += Replace(FileContents[I], "extern ", "", ReplacementFlags(false, false)) + "\n";
}
WriteFile("C:/Users/Brandon/Desktop/OGL Editing/GLNamingList.hpp", Final);
}

void GLCompare()
{
string ListOfGLExports = ReadFile("C:/Users/Brandon/Desktop/ListOfGLExports.hpp", false);
string CurrentExports = ReadFile("C:/Users/Brandon/Desktop/CurrentExports.hpp", false);

StringArray ListOfGLExportsSplit = SplitString(ListOfGLExports, "\n");
StringArray CurrentExportsSplit = SplitString(CurrentExports, "\n");
string Temp = string();
string Final = string();

for (size_t I = 0; I < ListOfGLExportsSplit.Size(); I++)
{
if (Pos(ListOfGLExportsSplit[I], CurrentExports, 0) == -1)
{
cout<<ListOfGLExportsSplit[I]<<endl;
}
}
}


int main(int argc, char* argv[])
{
StreamFlags(std::cout);

CreateGLFunctionsFromTypedefs();
CreateGLExternsFromTypedefs();
CreateGLDefinitionsFromTypedefs();
CreateGLAddressesFromDefinitions();
CreateGLNamingListFromExterns();

//GLCompare();

cin.get();
return 0;
}


What the above does, is generate a list of ALL OpenGL functions, its externs, its Definitions, its Detours, and its Address Procs. It uses a library I wrote myself called Purely-CPlusPlus. I posted it on SRL about last week when it got no attention so I removed it :c

To do it manually is a waste of time! Trust me! it's a total of 6000 lines of code being generated. Not including the undocumented ones which I decided to remove.

From that code, put it all into a DLL Module and LoadRS. RS Will load your DLL first which will in turn load the original OpenGL but instead of RS passing commands to the original, it will pass it to yours which will read it and log it and then pass it to the original. Thus we can modify calls, log them, do whatever with them, and as such, create wireframes which look like:

http://i.imgur.com/GGVfQ.png

Edit: Item Recognition is Ok.. Algorithm is still shit.
http://i.imgur.com/a6452.pnghttp://i.imgur.com/rDdra.pnghttp://i.imgur.com/MDZAN.png

Edit 2:
I'm getting close and close to model recognition. Don't have an algorithm for ID's yet. I believe I can actually store a list of vertices due to the way I wrote the model code. I stored the vertex pointer's pointer. I get the index count and divide by 3 for triangle count. Iterate the pointer for each triangle and store the vertex (THEORETICAL. It should work though.. I hope). At the time of posting the following pictures, I store only the first vertex and offset the Y by 213 (50 for the bar).
http://i.imgur.com/xnvSV.png
http://i.imgur.com/LPAhG.png
http://i.imgur.com/kM6Id.png

EDIT3: Grabbing Texts are working.. Positions are off but I THINK I can fix that (What I have in mind is theoretical, Heavy use of matrices ={ ).. Also as you can see, it renders shadows too so I've provided parameters to the function to specify whether the text we want should have a shadow or not. I have to fix positions first though.
http://i.imgur.com/Bfcn1.png

http://i.imgur.com/3Yrdk.png

http://i.imgur.com/Ybg49.png

Now it's up to you guys to do stuff with the logs OR teach me the math required to generate ID's out of those models above or throw some ideas out there for whoever decides to pick this shit up if I leave or whatever.. Now I have to learn the math required to generate ID's. Yes I did a bit of hacking and all that crap before but this math is OpenGL math.. It's not the same :c. Math with depth, height, width, view, etc.. I did calculus but i'm not sure if that is enough. So you guys pitch in where you can. Try to learn OpenGL too. It took me a total of 6 days to get this far. 2 Days of trial and error and testing and crashes due to jagex's bs and the fact that my generator messed up a couple functions (though that is fixed now). With a little CPP background, OGL won't take long to catch on.. The github is 4 days old but it took me 6 to get this far. I don't know how far I can push this project so everyone needs to learn it and pitch in. That goes for directX too. I'll help mato wherever I can.

P.S. I was asked to show u guys this. I actually wasn't going to show anything just yet because questions will hit me left right and center like OMG when is ETA and all that stuff such as the ones seen on Mato's thread.

NKN
07-13-2012, 07:48 AM
Nice, all I can say, I'm totally clueless on OpenGL programming.

Bobzilla69
07-13-2012, 07:49 AM
Now this is brilliant, good work you got further than i have with my failed attempt

grats
07-13-2012, 07:50 AM
I am also clueless with this level of stuff, as always I offer my VM's if they would be of any use, up to 10cores & 10gb of memory

really good work though, maybe we can get everyone working on 1 project instead of like 5 different ones

eska
07-13-2012, 07:59 AM
Looks very good. Can't wait to see this in action.

Flight
07-13-2012, 08:33 AM
Have you looked through Silab's OGL source on Github? This (https://github.com/silabsoft/SimbaGL/blob/master/opengl32/opengl32.cpp) might have some of what you're looking for.

Brandon
07-13-2012, 08:40 AM
Have you looked through Silab's OGL source on Github? This (https://github.com/silabsoft/SimbaGL/blob/master/opengl32/opengl32.cpp) might have some of what you're looking for.

I looked at it but I didn't like the C-style coding. I don't want to rely on guess work either. According to that source, it says an item is an inv item if it's vertex or triangle count is between 135 to 37 or something.

Right now all I have is the wrapper dll and an injector and a couple functions done. I wrote a DebugWindow function, a couple Bitmaps from client function using DC's and GDI and glReadPixels and yeah. That's about it I think.

I gotta learn the math though to count verticies, normalize crap, etc.. That's what's killing me. I'll learn it eventually. I can only work on this when I have free time so yeah.

Flight
07-13-2012, 10:00 AM
I looked at it but I didn't like the C-style coding. I don't want to rely on guess work either. According to that source, it says an item is an inv item if it's vertex or triangle count is between 135 to 37 or something.

Right now all I have is the wrapper dll and an injector and a couple functions done. I wrote a DebugWindow function, a couple Bitmaps from client function using DC's and GDI and glReadPixels and yeah. That's about it I think.

I gotta learn the math though to count verticies, normalize crap, etc.. That's what's killing me. I'll learn it eventually. I can only work on this when I have free time so yeah.

Yes if I read Aftermath's notes correctly he was identifying inventory items, like you said, based on the triangle count. I would imagine this was a simple difference between 2D and 3D sprites (mainscreen sprites vs everything else).

You're off to a promising start and I surely look forward to seeing this develop. I'll check back on this thread as much as I can.

Wizzup?
07-13-2012, 10:57 AM
This is very nice.


I looked at it but I didn't like the C-style coding. I don't want to rely on guess work either. According to that source, it says an item is an inv item if it's vertex or triangle count is between 135 to 37 or something.

Right now all I have is the wrapper dll and an injector and a couple functions done. I wrote a DebugWindow function, a couple Bitmaps from client function using DC's and GDI and glReadPixels and yeah. That's about it I think.

I gotta learn the math though to count verticies, normalize crap, etc.. That's what's killing me. I'll learn it eventually. I can only work on this when I have free time so yeah.

I suppose it would be useful to keep some contact with Aftermath, because I think it looks like he was actually quite far. Also, to be honest, I don't really dislike their coding style much, but I'm not sure if that's what you meant.

Great job so far! This requires a lot of dedication. :)

Abu
07-13-2012, 06:12 PM
Is the math for OGL and DirectX different? Could Mato help you with any of the math?

If that makes sense...

Brandon
07-13-2012, 06:36 PM
Is the math for OGL and DirectX different? Could Mato help you with any of the math?

If that makes sense...

It should be the same. I looked into DX API so that I could help him wherever I can as well.
It's not hard to go from DX to GL. I'm actually reading up on the algorithms and math crap right about now. At the same time logging calls from the client to figure out what to hook for what and which calls are useless, etc..

I put in a couple hotkeys for different functions already made.

Sin
07-13-2012, 06:38 PM
Glad to see you made progress :D

pk master999
07-13-2012, 07:14 PM
wow nice

Brandon
07-26-2012, 02:09 AM
Finding Items by Texture Checksum ID I got working but it labels the wrong Item :S Meaning it draws ID's at the wrong coordinates.

List Of ID's some of the ID's I got from Saving the Items as images with their corresponding checksum ID:
http://i.imgur.com/cGR7t.png


Labeling the wrong ID's:
http://i.imgur.com/tLYqB.png


Anyone got any clue what the problem could be? I hooked it like so:


#include <gl/gl.h>
#include <gl/glu.h>
#include "PurelyCPlusPlus/Defines.hpp"

struct InventoryItem
{
GLint X, Y;
GLint TextureID;
GLint CheckSum;
};

struct Model
{
GLfloat X, Y, Z, W;
uint32_t Stride, ID;
uint32_t XS, YS;

struct Triangles
{
GLfloat X1, Y1, Z1;
GLfloat X2, Y2, Z2;
GLfloat X3, Y3, Z3;
};
};

int CheckSum(int Width, int Height, void* PixelData, uint32_t BitsPerPixel)
{
int Result = 0;
int CheckSum = 0;
unsigned char* BuffPos = static_cast<unsigned char*>(PixelData);
Height = (Height < 0 ? -Height : Height);

for (int I = 12; I < Height; I++) //Starts at 12-14 so that it doesn't include the digits (Item Amount).
{
for (int J = 0; J < Width; J++)
{
Result += *(BuffPos++);
Result += *(BuffPos++);
Result += *(BuffPos++);
CheckSum += (BitsPerPixel > 24 ? *(BuffPos++) : 0);
}
if (BitsPerPixel == 24)
BuffPos += Width % 4;
}
Result = CheckSum; //For now just use the Alpha pixels as the checksum.. Todo: Fix it later! This is a shitty checksum.
return Result;
}



bool ItemFound = false;
bool DrawItem = false;
InventoryItem CurrentItem;
std::vector<InventoryItem> ListOfItems;
std::vector<Model> ListOfModels;

GL_EXPORT __stdcall void GLHook_glEnd(void)
{
if (ItemFound)
{
ListOfItems.push_back(CurrentItem);
ItemFound = false;
}
(*optr_glEnd) ();
}

GL_EXPORT __stdcall void GLHook_glBindTexture(GLenum target, GLuint texture)
{
if (LogCalls)
{
if (target == GL_TEXTURE_RECTANGLE_NV)
{
GLint Width = 0, Height = 0; int BitsPerPixel = 32;
glGetTexLevelParameteriv(GL_TEXTURE_RECTANGLE_NV, 0, GL_TEXTURE_WIDTH, &Width);
glGetTexLevelParameteriv(GL_TEXTURE_RECTANGLE_NV, 0, GL_TEXTURE_HEIGHT, &Height);
if (Width <= 60 || Height <= 60 || Width >= 30 || Height >= 30)
{
ItemFound = true;
std::vector<unsigned char> PixelData(((Width * BitsPerPixel + 31) / 32) * 4 * Height);
glGetTexImage(GL_TEXTURE_RECTANGLE_NV, 0, BitsPerPixel > 24 ? GL_BGRA : GL_BGR, GL_UNSIGNED_BYTE, &PixelData[0]);
CurrentItem.CheckSum = CheckSum(Width, Height, &PixelData[0], BitsPerPixel);
CurrentItem.TextureID = texture;
//Bitmaps BMP = Bitmaps(Width, Height, PixelData, 32);
//std::string SavePath = "C:/Users/Brandon/Desktop/GLImages/" + ToString(CurrentItem.CheckSum) + ".bmp";
//BMP.Save(SavePath.c_str());
}
}
}
(*optr_glBindTexture) (target, texture);
}

GL_EXPORT __stdcall void GLHook_glVertex2i(GLint x, GLint y)
{
if (ItemFound)
{
CurrentItem.X = x;
CurrentItem.Y = y;
}
(*optr_glVertex2i) (x, y);
}

GL_EXPORT __stdcall BOOL GLHook_wglSwapBuffers(HDC hdc)
{
Commands();
bool Result = (*optr_wglSwapBuffers) (hdc); //Ah shit.. :c Bad.. Need to find a better way of passing + drawing.
if (LogCalls)
{
if (DrawItem)
{
for (int I = 0; I < ListOfItems.size(); I++)
{
HDC DC = wglGetCurrentDC();
glPrint(DC, RGB(255, 0, 0), ListOfItems[I].X, ListOfItems[I].Y, "%i", ListOfItems[I].CheckSum);
}
}
ListOfItems.clear();
}
return Result;
}



#include <windows.h>
#include "Models.hpp"
#include "PurelyCPlusPlus/Functions.hpp"
#include <vector>
#include <cstdio> //I really hate having to use variadic functions instead of templates.. //Todo: Fix it (glPrint).

extern bool DrawItem;
extern InventoryItem CurrentItem;
extern std::vector<InventoryItem> ListOfItems;
bool LogCalls = false;

void Commands()
{
if (GetAsyncKeyState(VK_F11) & 1)
{
DrawItem = !DrawItem;
GLint SearchItemID = 0;
//std::string FileData = ReadFile("C:/Users/Brandon/Desktop/ItemID.txt", false);
SearchItemID = 90270;
for (std::vector<InventoryItem>::iterator it = ListOfItems.begin(); it != ListOfItems.end(); it++)
{
if (it->CheckSum == SearchItemID)
{
CurrentItem.CheckSum = SearchItemID;
CurrentItem.TextureID = it->TextureID;
CurrentItem.X = it->X;
CurrentItem.Y = it->Y;
break;
}
}
}

if (GetAsyncKeyState(VK_F12) & 1)
{
LogCalls = !LogCalls;
}
}

void glPrint(HDC &DC, COLORREF Colour, int X, int Y, const char* format, ...)
{
if (format == NULL) return;
char text[256];
va_list ap;
va_start(ap, format);
vsprintf(text, format, ap);
va_end(ap);

SelectObject(DC, GetStockObject(NULL_BRUSH));
SetBkMode(DC, TRANSPARENT);
SetTextColor(DC, Colour);

TextOut(DC, X, Y, text, strlen(text));
}



Also why is my text not being drawn with a transparent background.. I literally tried everything!! I know it looks dirty right now but I'll clean it up after I figure out why it labels wrong :S Oh and what should I use to generate ID's my algorithm is horrible.. I had to cut off the part that contains the numbers for stacked items.. The slight change in colour will affect it if I use R, G, and B as the checksum so I used alpha alone. Either way I still had to cut off the top to ignore the numbers which is bad. Any ideas?

Kasi
07-26-2012, 02:26 AM
Erm, try setting the background color to transparent before you select the object? sometimes shifting stuff around works -.-

Brandon
07-26-2012, 02:28 AM
Erm, try setting the background color to transparent before you select the object?

Tried that already.. doesn't work :S

EDIT: Fixed the ID's labelling problem:
The algorithm is soooo bad.. Notice how the two Items in the invent have the same ID? I forgot what they're called :P ID: 71145.
http://i.imgur.com/67fMY.png


EDIT: Got Item/Panel/Icon ID's looking much much cleaner!
http://i.imgur.com/a6452.pnghttp://i.imgur.com/rDdra.pnghttp://i.imgur.com/MDZAN.png

whaevr
07-26-2012, 03:29 AM
I remember reading on the DirectX topic a similar problem, the "talismans" :P or ID 7115 have the same id because they use the same model.

Therefore with the way that you calculate IDs, objects that use the same model, runes, talismans, arrows (guessing) would all have the same ID

Im not sure if Mato ever figured a way around this or not...just throwing my 2 cents in hah

P1ng
07-26-2012, 03:31 AM
I remember reading on the DirectX topic a similar problem, the "talismans" :P or ID 7115 have the same id because they use the same model.

Therefore with the way that you calculate IDs, objects that use the same model, runes, talismans, arrows (guessing) would all have the same ID

Im not sure if Mato ever figured a way around this or not...just throwing my 2 cents in hah
Use ID to check item-type (rune,talisman,arrow) then use colour to determine whether or not it is a specific one of those.

whaevr
07-26-2012, 03:39 AM
Use ID to check item-type (rune,talisman,arrow) then use colour to determine whether or not it is a specific one of those.

Right I know that would probably be possible. I was referring to if Mato ever figured out a way to develop unique IDs for EVERY item

[XoL]
07-26-2012, 03:42 AM
God man, you blow me out of the water with this stuff. Best of luck :)
Oh grats on senior member :)

Flight
07-26-2012, 03:47 AM
I remember reading on the DirectX topic a similar problem, the "talismans" :P or ID 7115 have the same id because they use the same model.

Therefore with the way that you calculate IDs, objects that use the same model, runes, talismans, arrows (guessing) would all have the same ID

Im not sure if Mato ever figured a way around this or not...just throwing my 2 cents in hah

From my point of view similar items like that share the same model ID; the basic shape. But as far as I know we can go further and grab textures for each item. Kinda like colour for OGL.

I'm not sure if that's right but that's my understanding of it.

Frement
07-26-2012, 05:24 AM
Code from silentwolf:

DWORD QuickChecksum(DWORD *pData, int size)
{
if(!pData) { return 0x0; }

DWORD sum;
DWORD tmp;
sum = *pData;

for(int i = 1; i < (size/4); i++)
{
tmp = pData[i];
tmp = (DWORD)(sum >> 29) + tmp;
tmp = (DWORD)(sum >> 17) + tmp;
sum = (DWORD)(sum << 3) ^ tmp;
}

return sum;
}

Usage:

void sys_glBufferDataARB(GLenum target, GLsizei size, const void* data, GLenum usage)
{
bufferCRC[lastBuffer] = QuickChecksum((DWORD*)data, size);

orig_glBufferDataARB(target, size, data, usage);
}

Brandon
07-26-2012, 05:36 AM
Code from silentwolf:

DWORD QuickChecksum(DWORD *pData, int size)
{
if(!pData) { return 0x0; }

DWORD sum;
DWORD tmp;
sum = *pData;

for(int i = 1; i < (size/4); i++)
{
tmp = pData[i];
tmp = (DWORD)(sum >> 29) + tmp;
tmp = (DWORD)(sum >> 17) + tmp;
sum = (DWORD)(sum << 3) ^ tmp;
}

return sum;
}Usage:

void sys_glBufferDataARB(GLenum target, GLsizei size, const void* data, GLenum usage)
{
bufferCRC[lastBuffer] = QuickChecksum((DWORD*)data, size);

orig_glBufferDataARB(target, size, data, usage);
}

Problem with that is that glBufferDataARB doesn't exist in OpenGL anymore.. well at least I cannot find any documentation on it. After decompiling the OpenGL in system32, it's not there either. Infact, none of the ARB functions are. It doesn't seem to be a wiggle function either. I'll look into it more. For now I figured out how to render properly and label things as I go along cleaner than before and faster. Had to ditch GDI completely:


http://i.imgur.com/YFKkt.png

Just have to clear it up more and remove unneccesary ones such as the border of the chatbox and background ID's, etc. And work on a better algorithm or see if I can grab textures before the digits get draw on it. I think I messed up somewhere though.. that little mind rune isn't showing up properly unless I hover over it.

Frement
07-26-2012, 05:41 AM
All the ARB methods should be there, as far as I know, and last I've checked.

Brandon
07-26-2012, 05:45 AM
All the ARB methods should be there, as far as I know, and last I've checked.

Decompile it and you get:
https://github.com/Brandon-T/GLHook/blob/master/OGL%20Editing/GLHookInfo/GLExports.txt

Not on MSDN either.

Frement
07-26-2012, 06:19 AM
6BDDABB0 PUSH OFFSET 6BDE1C44 ASCII "wglGetExtensionsStringARB"
6BDDABD6 PUSH OFFSET 6BDE1C60 ASCII "WGL_ARB_pixel_format"
6BDDABE8 PUSH OFFSET 6BDE1C78 ASCII "wglChoosePixelFormatARB"
6BDDABF2 PUSH OFFSET 6BDE1C90 ASCII "WGL_ARB_pbuffer"
6BDDAC04 PUSH OFFSET 6BDE1CA0 ASCII "wglGetPbufferDCARB"
6BDDAC0B PUSH OFFSET 6BDE1CB4 ASCII "wglCreatePbufferARB"
6BDDAC17 PUSH OFFSET 6BDE1CC8 ASCII "wglDestroyPbufferARB"
6BDDAC23 PUSH OFFSET 6BDE1CE0 ASCII "wglReleasePbufferDCARB"
6BDDAC41 PUSH OFFSET 6BDE1CF8 ASCII "WGL_ARB_multisample"
6BDDAD37 PUSH OFFSET 6BDE1D0C ASCII "glGenBuffersARB"
6BDDAD3E PUSH OFFSET 6BDE1D1C ASCII "glBindBufferARB"
6BDDAD4A PUSH OFFSET 6BDE1D2C ASCII "glBufferDataARB"
6BDDAD56 PUSH OFFSET 6BDE1D3C ASCII "glBufferSubDataARB"
6BDDAD62 PUSH OFFSET 6BDE1D50 ASCII "glMapBufferARB"
6BDDAD6E PUSH OFFSET 6BDE1D60 ASCII "glUnmapBufferARB"
6BDDAD7A PUSH OFFSET 6BDE1D74 ASCII "glDeleteBuffersARB"
6BDDAD86 PUSH OFFSET 6BDE1D88 ASCII "glGenProgramsARB"
6BDDAD92 PUSH OFFSET 6BDE1D9C ASCII "glBindProgramARB"
6BDDAD9E PUSH OFFSET 6BDE1DB0 ASCII "glProgramStringARB"
6BDDADAA PUSH OFFSET 6BDE1DC4 ASCII "glProgramLocalParameter4fARB"
6BDDADB6 PUSH OFFSET 6BDE1DE4 ASCII "glProgramLocalParameter4fvARB"
6BDDADC2 PUSH OFFSET 6BDE1E04 ASCII "glGetInfoLogARB"
6BDDADCE PUSH OFFSET 6BDE1E14 ASCII "glGetProgramivARB"
6BDDADDA PUSH OFFSET 6BDE1E28 ASCII "glDeleteProgramsARB"
6BDDADE6 PUSH OFFSET 6BDE1E3C ASCII "glCreateShaderObjectARB"
6BDDADF2 PUSH OFFSET 6BDE1E54 ASCII "glCreateProgramObjectARB"
6BDDADFE PUSH OFFSET 6BDE1E70 ASCII "glShaderSourceARB"
6BDDAE0A PUSH OFFSET 6BDE1E84 ASCII "glCompileShaderARB"
6BDDAE16 PUSH OFFSET 6BDE1E98 ASCII "glAttachObjectARB"
6BDDAE22 PUSH OFFSET 6BDE1EAC ASCII "glDetachObjectARB"
6BDDAE2E PUSH OFFSET 6BDE1EC0 ASCII "glLinkProgramARB"
6BDDAE3A PUSH OFFSET 6BDE1ED4 ASCII "glUseProgramObjectARB"
6BDDAE46 PUSH OFFSET 6BDE1EEC ASCII "glGetUniformLocationARB"
6BDDAE52 PUSH OFFSET 6BDE1F04 ASCII "glUniform1fARB"
6BDDAE5E PUSH OFFSET 6BDE1F14 ASCII "glUniform1iARB"
6BDDAE6A PUSH OFFSET 6BDE1F24 ASCII "glUniform2fARB"
6BDDAE7B PUSH OFFSET 6BDE1F34 ASCII "glUniform3fARB"
6BDDAE82 PUSH OFFSET 6BDE1F44 ASCII "glUniform4fARB"
6BDDAE8E PUSH OFFSET 6BDE1F54 ASCII "glUniform1fvARB"
6BDDAE9A PUSH OFFSET 6BDE1F64 ASCII "glUniform2fvARB"
6BDDAEA6 PUSH OFFSET 6BDE1F74 ASCII "glUniform3fvARB"
6BDDAEB2 PUSH OFFSET 6BDE1F84 ASCII "glUniform4fvARB"
6BDDAEBE PUSH OFFSET 6BDE1F94 ASCII "glUniformMatrix2fvARB"
6BDDAECA PUSH OFFSET 6BDE1FAC ASCII "glUniformMatrix3fvARB"
6BDDAED6 PUSH OFFSET 6BDE1FC4 ASCII "glUniformMatrix4fvARB"
6BDDAEE2 PUSH OFFSET 6BDE1FDC ASCII "glGetObjectParameterivARB"
6BDDAEEE PUSH OFFSET 6BDE1FF8 ASCII "glDeleteObjectARB"

All the ARB methods I got for now, there are more after some normal methods, but cbf to paste them.

Brandon
07-26-2012, 02:43 PM
All the ARB methods I got for now, there are more after some normal methods, but cbf to paste them.

Hey what did you use to get those? http://www.gamedev.net/topic/487333-glgenbuffers-vs-glgenbuffersarb/

According to that link, my OpenGL might be too new to use SilentWolf's stuff.. I'd have to port it to the GL that I have or use glExtensionSupported for backwards compatibility and to check if it exists. I really really don't wanna have to re-write the generator for those and to support multiple versions but I will if I have to..

I spent the last hour going through the glDLL that Jagex provides with their client and it doesn't have that.. At least not for me :S Their DLL is dated 2008.

Also I tried hooking those half an hr ago, it gives a massive stacktrace for multiple null pointers during initialization which causes the RS client to crash on my comp :S

What OS are you using? And if you know, what version gl?

grats
07-26-2012, 02:49 PM
Do graphics cards matter vs what openGL you have too? I know some older ones only support like opengl 2.1 etc where mine supports 4.2, is it based on the systems installed version or what is supported?

Brandon
07-26-2012, 02:52 PM
Do graphics cards matter vs what openGL you have too? I know some older ones only support like opengl 2.1 etc where mine supports 4.2, is it based on the systems installed version or what is supported?

AFAIK, it's the system supported version. Either way, the hooks and functions I have now supports the latest GL. My laptop that I work on is fairly old as well but somehow has a newer GL. But as stated before, if I really really really have to then I'll re-write the generator to generate the ARB hook functions and just check if the extensions exist before using them (should get rid of null pointer crap for newer GL's) ={

Probably have to throw in a couple Ifdef's too for linux ppl soon enough but first I'll finish what I have.

Frement
07-26-2012, 02:55 PM
In addition to our PM conversation, I use OllyDbg for debugging. (with PhantOm plugin)

grats
07-26-2012, 02:55 PM
Wow that sounds like a lot of crap, too bad they don't have some backwards compatibility in the newer versions (writing to their API wise) I really have no idea about any graphics API stuff at all..
http://en.wikipedia.org/wiki/ARB_%28GPU_assembly_language%29

and I assume that is what your ARB is standing for

Brandon
07-26-2012, 03:00 PM
Wow that sounds like a lot of crap, too bad they don't have some backwards compatibility in the newer versions (writing to their API wise) I really have no idea about any graphics API stuff at all..
http://en.wikipedia.org/wiki/ARB_%28GPU_assembly_language%29

and I assume that is what your ARB is standing for


Yeah and it's architecture dependent style.. Meaning Nvidia cards would use NV_glActivetexture whereas the universal OpenGL.dll ships with glActivetexture and the 2002 version ships with glActivetextureARB, etc..

All the ARB, NV, gl functions are the same just different crap same usage. They all do the same thing. Sucks! :c
I'm going to try it on a really really old comp for 2001 and see if those calls are made and if it'll adapt to my current glwrapper. If it does then the git will stay the same for now.. if not then it's probably a couple day's work to support all cards and versions.

They're supposed to ship with OpenGL.dll but frement mentioned Jaggl.dll so I'm going to check that first.

EDIT: Got it.. No need to make one for each architecture.. Just do like jagex do and export them so they all point at the same damn function.. Infact I think they did all the work for me :S If I'm correct, any calls to those functions should be redirected to my dll. I'll test first and if I'm correct, the dll will not need changing.. If I'm wrong I'll export the same crap as them.

EXT, ARB, and Universal GL all point to the same functions (hopefully).. notice the @values

EDIT: It doesn't point to the same functions.. Just noticed the addresses.. Time to re-write my generator then -______- It's ok though. Not tooo much work. Better late than sorry.
http://i.imgur.com/RfPBw.png

grats
07-26-2012, 03:04 PM
hmm, that gives me more respect to game development then, mostly to cross platform game development

well again if you need my computer for testing or something let me know, I have (nvidia) GTX 680 so it should be a good example of what people will be using now - in the future to get your stuff working for that, good work though I'd blow up my house writing in graphics API's


oh yea nice edit, so I guess you could write it so it detects which set it needs so then it uses the correct pointer things to the correct function etc

J J
07-27-2012, 09:28 AM
Tried that already.. doesn't work :S

EDIT: Fixed the ID's labelling problem:
The algorithm is soooo bad.. Notice how the two Items in the invent have the same ID? I forgot what they're called :P ID: 71145.
http://i.imgur.com/67fMY.png
I've been busy with learning java for the past 2 weeks or so (during 4 week period, was on holiday aswell :P). I've been working on some stuff for TRiBot which uses OpenGL hooking aswell. I'm not sure if the hooks are open source but you could look into the docs.

http://tribot.org/doc/

It is normal that they have the same ID's as they have the same model ID's. What Trilez did is that he also put the RGB values there. It sort of looks like I'm advertising TRiBot right now but it is OpenGL and I've got a week experienec with scripting there now :P Here is an example of the inventory items http://www.youtube.com/watch?v=-QF8tqkNJl8

Anyways enough about TRiBot. I hope to learn some stuff about hooking within the next 1-2 years I guess, I still need to learn C++ and more java as my experience is just 2 weeks of reading and testing stuff. But I've been learning pretty fast I think, can't really compare it to others though. I hope to be able to hook by hacking the .jar or opengl/directx hooking in the future. Just to learn about that stuff even though Simba will probably have DirectX & OpenGL hooking included by then.

Good luck with this :P

Brandon
08-05-2012, 07:06 AM
For anyone willing to test it and see how far I got:

http://www.mediafire.com/?1owt183wo7grz3w

Instructions:

1. Download the Runescape official client: http://www.runescape.com/downloads.ws
2. Install the client.
3. Place the opengl32.dll from the mediafire link into the bin folder of the client. For me this is: C:\RS\jagexcache\jagexlauncher\bin
4. Load the client. Switch to OpenGL mode.
5. Press F11 to display stuff on the screen.

Optional:

If you do decide to login, press F1 - F8 to display different models/Items (Model ID's all set to 0 atm for ease of debugging/seeing what is what). DO NOT press F10. I forgot to remove it but it's for debugging and it WILL LAG YOU!

Again. F1 - F8 for different display modes. F11 to turn displaying off and on. Also note that if you see "double" text, it's not a mistake. It's rendering shadows by default since I turned it on inside the DLL. This can be optional at any time so that it doesn't show the font shadows. Also note that characters such as p, q, y, g have tails and thus they render lower than others.. they "hang down" which is why I call them "hanging" characters. This will be fixed hopefully.

From Euphemism on IRC:
http://puu.sh/OLh8

eska
08-05-2012, 09:18 AM
Man this is looking so good. Can't wait to actualy use this in scripts. It should make things much easier than with just colors.

Now time to test this :)

Edit: I did all those test while loged in, not in the menu.

A few F keys do not work proprely. I tested it on 2 computer and I get the same issues. First computer was a 4 years old Asus laptop and the other one ~2000$ desktop I built this fall.

F1 works (shows player)

F2 (partialy?) works
It shows the models of scenery (building, walls, bushes) but not all of it. (Ex: In lumbridge, there is 4 bushes at the entrace of the lumbridge castle, where you respawn when you die. Pressing F2 will only display the models of 3 out of 4 bushes.)
Also, if you run/walk with this display mode, it messes up the minimap, but it fix iteself every few seconds.

F3 is broke but when it display proprely it seems good.
It only display Id's when in the prayer tab or magic tab and when the mouse isn't in the main screen, or over anything that is clickable (Ex: Melee protect, or any prayer button, the "run" button, any spell, report abuse button, "chat" button, game tab etc...)

F4 (partialy?) works.
It display the model of the ground proprely all the time, but it also does the following:
Display the models of the scenery that should be displayed by F2 (the parts that F2 doesn't display)
Display Ids like F3 and has the same problem as F3.
If you press F8 while viewing things using F4, some more Id's will be added (asuming you were already seeing Id by placing your mouse over something that can't be clicked)

F5, F6, F7 and F8 do not display anything for me.

F10... I do notice that it gets laggy when I press F10.

F11 works just fine.

This is what F2 looks like:
http://i48.tinypic.com/35jvv5s.jpg

All in all very impressive work. Really reminds me of injection. I really feels like this is the way to go.

Brandon
08-05-2012, 01:58 PM
Ahh resizeable client. I forgot to adjust the offset. In fixed mode, all the keys should work. Also by the sounds of it, that sounds perfect. Why? Because models are drawn with different "Strides". A stride is the distance from one vertex to get to another of that same kind.

X to X = Stride + pointer;
Y to Y = Stride + pointer * sizeof(...)

etc.. That is why some strides only display some models. I think NPC's are 24, etc.. F8 is supposed to show the 0's on all models. Also yes when debugging, strides can change which is why F3 fixes itself.

Some of the strides like F4 - F7 are for higher detail modes. Ones with Fog and stuff. Wondering why your pic doesn't have the 0's for the ID's though.. Does fixed actually show these ID's? Also what graphics card do you have?

ATI? NV?


case VK_F1: Stride = 12; break;
case VK_F2: Stride = 16; break;
case VK_F3: Stride = 20; break;
case VK_F4: Stride = 24; break;
case VK_F5: Stride = 28; break;
case VK_F6: Stride = 36; break;
case VK_F7: Stride = 40; break;
case VK_F8: DrawAllStrides = !DrawAllStrides; break;
case VK_F9: InfoDisplayed++; break;
case VK_F10: LogCalls = !LogCalls; break;
case VK_F11: Overlay = !Overlay; break;

F9 will not do anything atm.. F10 might not lag you because the file is set to be created on my desktop. I guess it just catches an exception instead but on my comp, it'll lag me till kingdom come. It logs 37k calls per buffer swap. F5 - F7 should only work on super high detail. F8 should really display ALL Id's. I'm glad it's at least showing models but disappointed that I see no ID's :c I'll test it on resizeable.

EDIT: Figured it out. The offset is different in resizeable. That's ok. I'll fix it for the next test release whenever that is.

Gala
08-05-2012, 02:04 PM
Looks good so far. Brandon, where did you start learning OpenGL?

Brandon
08-05-2012, 02:08 PM
Looks good so far. Brandon, where did you start learning OpenGL?

I started on: 07-13-2012 on Nehe's tutorials, Soho's, looked at GameDeception for detouring and MSDN/OpenGL.org to get all function info.

That's about it I think. A couple others here and there but the ones above started me. Game deception doesn't help too much since it's all outdated but it's a good start to learn how to do wireframe for counter strike which is very similar to doing it here.

MSDN and OpenGL.org is the best places to find out what functions do and their parameters and when they should and shouldn't be called. Nehe's is legacy tutorials. Old but gold. Soho's is where I learned angles and matrices. Other sites I had to pick up the math from there.

Gala
08-05-2012, 07:01 PM
I started on: 07-13-2012 on Nehe's tutorials, Soho's, looked at GameDeception for detouring and MSDN/OpenGL.org to get all function info.

That's about it I think. A couple others here and there but the ones above started me. Game deception doesn't help too much since it's all outdated but it's a good start to learn how to do wireframe for counter strike which is very similar to doing it here.

MSDN and OpenGL.org is the best places to find out what functions do and their parameters and when they should and shouldn't be called. Nehe's is legacy tutorials. Old but gold. Soho's is where I learned angles and matrices. Other sites I had to pick up the math from there.

Do you know any books worth reading? I like to learn from books :)

Brandon
08-05-2012, 08:08 PM
Do you know any books worth reading? I like to learn from books :)

I'm not sure of any books. I have never actually read a programming book before. Perhaps someone can suggest one. I usually go with the hands on approach and trial and error to see how things work (I have the hardest time learning from books; hate reading). Once I do it hands on, it sticks.

I'll write up a couple tutorials on it when I get everything done I guess. That way if anything, someone else can start on whatever they want to hook or do/draw, etc..

eska
08-05-2012, 09:21 PM
Ahh resizeable client. I forgot to adjust the offset. In fixed mode, all the keys should work. Also by the sounds of it, that sounds perfect. Why? Because models are drawn with different "Strides". A stride is the distance from one vertex to get to another of that same kind.

X to X = Stride + pointer;
Y to Y = Stride + pointer * sizeof(...)

etc.. That is why some strides only display some models. I think NPC's are 24, etc.. F8 is supposed to show the 0's on all models. Also yes when debugging, strides can change which is why F3 fixes itself.

Some of the strides like F4 - F7 are for higher detail modes. Ones with Fog and stuff. Wondering why your pic doesn't have the 0's for the ID's though.. Does fixed actually show these ID's? Also what graphics card do you have?

ATI? NV?


case VK_F1: Stride = 12; break;
case VK_F2: Stride = 16; break;
case VK_F3: Stride = 20; break;
case VK_F4: Stride = 24; break;
case VK_F5: Stride = 28; break;
case VK_F6: Stride = 36; break;
case VK_F7: Stride = 40; break;
case VK_F8: DrawAllStrides = !DrawAllStrides; break;
case VK_F9: InfoDisplayed++; break;
case VK_F10: LogCalls = !LogCalls; break;
case VK_F11: Overlay = !Overlay; break;

F9 will not do anything atm.. F10 might not lag you because the file is set to be created on my desktop. I guess it just catches an exception instead but on my comp, it'll lag me till kingdom come. It logs 37k calls per buffer swap. F5 - F7 should only work on super high detail. F8 should really display ALL Id's. I'm glad it's at least showing models but disappointed that I see no ID's :c I'll test it on resizeable.

EDIT: Figured it out. The offset is different in resizeable. That's ok. I'll fix it for the next test release whenever that is.

No it doesn't display Id no matter what, it will only display Id when I'm in mode F3 and only when the cursor isn't over something clickable.

I've now redone the test but in fixed mode this time. It fix some Id but it doesn't fix much else.

I got a geforce 570 gtx on my desktop, and a geforce 9800m gs on my laptop.
Both with most recent stable drivers. Windows 7 on my desktop and windows vista on my laptop.

New test bellow:
F1 Shows the models of players. Pressing F8 doesn't do anything. No Id's are displayed.
F2 does the same as my previous test. Pressing F8 doesn't do anything. No Id's are displayed.
F3 does the same as my previous test. Pressing F8 now display some more Id's IF the mouse isn't over something clickable.
F4 does the same as my previous test, but also display some Id's with the same problem as F3. Pressing F8 add some Id's if the mouse isn't over something clickable.
F5, F6, F7, F9 does not display anything.
F8 does nothing most of the time.
F11 works.

Brandon
08-05-2012, 09:28 PM
No it doesn't display Id no matter what, it will only display Id when I'm in mode F3 and when I the cursor isn't over something clickable.

I've now redone the test but in fixed mode this time. I get the same issues I had in resizable.

I got a geforce 570 gtx on my desktop, and a geforce 9800m gs on my laptop.

Both with most recent stable drivers. Windows 7 on my desktop and windows vista on my laptop.

Ahh kk I'll have to probably put some IFDEF's for NVidia cards. Either that or I exported something wrong..

Edit: Try this if you want.. http://www.mediafire.com/download.php?h9c53eorhuwvjm2

It should look like the below (Has compass angle in this one and a couple fixes) Only thing I can think of is that the keys aren't registering for you or I need to include NVidia support separately.:

http://i.imgur.com/UC8eg.png

eska
08-05-2012, 09:40 PM
Ahh kk I'll have to probably put some IFDEF's for NVidia cards. Either that or I exported something wrong..

Edit: Try this if you want.. http://www.mediafire.com/download.php?h9c53eorhuwvjm2

It should look like the below (Has compass angle in this one and a couple fixes) Only thing I can think of is that the keys aren't registering for you or I need to include NVidia support separately.

You sure you sent me the good one? Nothing changed. I get the same issues as before.

What do you mean by keys no registering? When I press the F keys, the models do change, but not exactly like your picture.

Brandon
08-05-2012, 09:50 PM
You sure you sent me the good one? Nothing changed. I get the same issues as before.

:S Yeah I'm sure. I'll just get on a friend's comp with a NV graphics card and see how it works. That's the only thing I can think of that would make it not display like that.

Kyle Undefined
08-05-2012, 10:15 PM
Wow, this is fantastic work Ggzz! :)

EDIT: If I get some time, I'll try to help test.

Le Jingle
08-05-2012, 10:36 PM
Pretty cool work there!!!

I ran it on a nvidia graphics card; (not sure what each f key represents, but here's 3 that I noticed, in which definitely displayed visuals f1,2, and 4 iirc);

http://i.imgur.com/12NgL.png

http://i.imgur.com/Nh7z3.png

http://i.imgur.com/RdX4z.png

Edit: The first picture was kinda cool, there was a constant whirlwind of 0's around my player
Edit2: F1 seems to freeze some id's/things? all the other f keys will delete the visuals from 1/2/4. don't have any item id's showing up.

eska
08-05-2012, 10:59 PM
This is on my desktop, geforce 570 gtx, windows 7, i7 2600k.

Fixed mode, all graphic option to the lowest possible.

F1:
http://i48.tinypic.com/2i87lhh.jpg


F2:
http://i47.tinypic.com/346l5km.jpg


F3 (while placing the cursor over something you can't click, else all id's becomes invisible):
http://i47.tinypic.com/110y83b.jpg


F3 (with F8, while placing the cursor over something you can't click, else all id's becomes invisible):
http://i50.tinypic.com/b4jl7b.jpg


F4 (while placing the cursor over something you can't click, else all id's becomes invisible):
http://i48.tinypic.com/6tgumb.jpg


F4 (with F8, while placing the cursor over something you can't click, else all id's becomes invisible):
http://i49.tinypic.com/os5s15.jpg


For F1 and F2, F8 doesn't do anything.

Brandon
08-05-2012, 11:02 PM
Pretty cool work there!!!
I ran it on a nvidia graphics card; (not sure what each f key represents, but here's 3 that I noticed, in which definitely displayed visuals f1,2, and 4 iirc);

Edit: The first picture was kinda cool, there was a constant whirlwind of 0's around my player
Edit2: F1 seems to freeze some id's/things? all the other f keys will delete the visuals from 1/2/4. don't have any item id's showing up.

Yeah wireframe for the entire scene will spam you with 0's lol. Whereas wireframe for just a couple objects work fine. It doesn't clear the previous buffer that's y. Uhh if you want to see ID's, try clicking your prayer book then pressing F11 and see if it displays prayer ID's.

Also it seems I have reverse order byte problems :S Your text is black instead of blue =S. Looks like a card problem still. ATI cards are rendering it as cyan which it is. Yours is flipping the bytes for some reason. I'm just glad it at least displays the 0's though.


I'll check out different graphics cards before any releases of course. Both of you using a NV card and it renders as a teal sorta colour. Looks good though seeing as it shows all the models. It's probably something with my printing function as it's C-style printf for GL. I'll prob make it typesafe and use C++ as the entire DLL is cpp. Hopefully I can figure out why it prints like that while re-writing the printing.


@Eska at least it's showing the ID's now.

eska
08-05-2012, 11:12 PM
It is, and always has, the problem is that I can't move my cursor, if I do everything is gone until I place it somewhere I can't click. I'll show you a picture in a moment.

http://i49.tinypic.com/2dtugly.jpg


http://i48.tinypic.com/25hiyb5.jpg

For any button, or area where clicking will trigger an event, the ids becomes invisible.

Brandon
08-05-2012, 11:17 PM
It is, and always has, the problem is that I can't move my cursor, if I do everything is gone until I place it somewhere I can't click. I'll show you a picture in a moment.

It shouldn't have the problem if ported to Simba. Instead you'd be using Simba functions to communicate with it. So with that being said, I'm not worried about that part. I can fix that by using hotkeys instead of GetAsyncKeyState or using a different style of getting input so that will never be a problem.

Still I guess my code is a bit buggy but this is only the first of the DLL's so yeah. I'll make a list of all bugs and stuff and go through them.

EDIT: Investigating it now.. It's annoying me. Happening on my comp with an Intel Graphics card so I can fix it now.

eska
08-06-2012, 01:59 AM
I'm currently reading the code you posted on first post, RsHooks.cpp and Models.cpp, since that's where most of the magic happens, but like you said it's outdated.

If you could put the updated files once you get the chance to I'd love to read them and try to figure out exactly how it works. Might as well learn how it work since it's going probably going to be the future of (advanced) runescape botting.

Brandon
08-06-2012, 02:56 AM
Updated the git.. If you want to start, you might as well start with my notes that I made to myself while debugging and figuring things out:

https://github.com/Brandon-T/GLHook/blob/master/OGL%20Editing/GLHookInfo/GLNotes.hpp

It's sloppy but it's just a taste of what is to come really. You know the patterns in the notes, you'll understand the code.

And these are the hooks and some of the math involved: https://github.com/Brandon-T/GLHook/blob/master/RSHooks.cpp

The rest is in the matrix class and vector3d class.

Was planning on leaving the models and text recognition out of the source since I don't want tribot or rsbot using it. It has never been done before so yeah.. Might remove it tomorrow and keep that part private. I'm sorta inbetween on the opensource topic since I need it open source so other can work on it but at the same time need to prevent other bots from adapting it.

Some other stuff I've been doing around the net:

http://stackoverflow.com/questions/11820715/opengl-hooking-vertex-buffer
http://stackoverflow.com/questions/11804790/gltranslatef-equivalent-without-it
http://stackoverflow.com/questions/11812822/getcamera-angle-opengl

http://www.daniweb.com/members/623660/triumphost/threads <-- All posts I've ever made learning C++ and OpenGL.

None of my threads have been answered.. instead I've been told "not possible".. Well I've solved those problems already so it is possible.


EDIT: The hook generator: https://github.com/Brandon-T/GLHook/blob/master/OGL%20Editing/GLHookGenerator.cpp

That is going to be very important. Every time I hook a new function, the generator will generate the typedefs, pointers and structure of that function so you don't have to write it out. After all who wants to write 9k lines of code.

Also note: All declarations are in headers (.hpp), all implementations are in the bodies (.cpp).

eska
08-06-2012, 03:27 AM
Thanks Brandon, I'll try to figure this out.

It's a bit overwhelming though, all that new stuff, never really looked into OpenGl or Directx before so I'm not expecting to understand this on a dime.

Brandon
08-06-2012, 03:29 AM
Thanks Brandon, I'll try to figure this out.

It's a bit overwhelming though, all that new stuff, never really looked into OpenGl or Directx before so I'm not expecting to understand this on a dime.

LOL yeah it's a lot! To think I even wrote that stuff from scratch.. but yeah take your time. It'll come to you eventually by trial and error most likely.

Hazzah
08-06-2012, 06:43 AM
This is looking amazing! Earlier in the thread you seemed to be caught on the fact that ID's for certain objects were the same, however could you just use color + uptext to figure out which one is the correct one?

I have been waiting on Mato's DX Interception but he has been busy lately it appears!

eska
08-06-2012, 06:52 AM
This is looking amazing! Earlier in the thread you seemed to be caught on the fact that ID's for certain objects were the same, however could you just use color + uptext to figure out which one is the correct one?

I have been waiting on Mato's DX Interception but he has been busy lately it appears!

He's not going to use the uptext since you'd need to move the mouse to the object.

Right now he's only using the models of the item to make ID's but the issue is that jagex reuse many models for different items.

For example, talisman all use the same model. Only the name and the colour change. Same goes for runes, and I can't test but I believe all armor/weapon you can smith would also have the same ID too since they all look the same except for the colour. (Ex: Rune platebody = addy platebody = black platebody etc)

What he will probably do is create an algorithm that make an ID's using both the models and the colour of the texture, that way he'll be left with unique ID's.

Hazzah
08-06-2012, 07:16 AM
He's not going to use the uptext since you'd need to move the mouse to the object.

Right now he's only using the models of the item to make ID's but the issue is that jagex reuse many models for different items.

For example, talisman all use the same model. Only the name and the colour change. Same goes for runes, and I can't test but I believe all armor/weapon you can smith would also have the same ID too since they all look the same except for the colour. (Ex: Rune platebody = addy platebody = black platebody etc)

What he will probably do is create an algorithm that make an ID's using both the models and the colour of the texture, that way he'll be left with unique ID's.

Ahhh, that true, if you are a member (I see Brandon is not) he could get an omni-talisman. But this just avoids the issue.

eska
08-06-2012, 07:26 AM
Ahhh, that true, if you are a member (I see Brandon is not) he could get an omni-talisman. But this just avoids the issue.

The problem isn't the model itself, it's when the same models is used for more than one item.

The omni-talisman model is unique, it's only used for the omni-talisman so not an issue. Also he can do the algorithm without being member since it will be the job of the algorithm to assign a unique ID to all objects it finds.

Brandon
08-06-2012, 07:29 AM
Ahhh, that true, if you are a member (I see Brandon is not) he could get an omni-talisman. But this just avoids the issue.

I am a member.. I just like to test on the noob account while my member account bots ;)

Also for Intel/NVidia guys, it's actually a problem with my printing function. For now try this and let me know if ID's display at all. I know it's going to look hella ugly but it's not permanent:

http://www.mediafire.com/?2fn14vjv790fjkn

It's just for testing so that I can know if the ID's are good and if the positions are fine.. Then I can pretty it up a bit. I got it to show ID's on my intel and nvidia machines.. It looks really disgustingly ugly though but I pulled a quick jagex and rendered each character one by one instead using GDI not opengl.

I've tried 6 different compilers, 4 different machines + a couple friends'.. so I know it's not my code but rather the way each company's card renders -_-

eska
08-06-2012, 07:34 AM
Now we're talking:

It seems like the B in "Banker" is messed up but I think it's just because the 'a' is overlaping it. The chat tab are also messed up for the same reason. Who gives a damn though it works!
http://i45.tinypic.com/29g0oqp.jpg

F1:
http://i49.tinypic.com/20jfw5f.jpg

Brandon
08-06-2012, 07:37 AM
Now we're talking:

YES!! So it is the cards -__- damn. Ahahaha that looks beautiful for code but ugly for eye candy. Either way I can now fill in all those 0's with their proper ID's and prettify the fonts/rendering later. Probably port it to simba first though and have smart or simba draw the ID's instead. I'll see. More than enough possibilities atm. I'll prob stick to prettifying it after I implement those ID's.

eska
08-06-2012, 07:50 AM
I just tried in resizable and made it full screen and it works for the most part. The only things that messes up is the position of the Id's on the main screen.

I know it's not meant to be used in resizable mode but I think I'm a pretty cool guy, I test stuff and doesn't afraid of anything.

Brandon
08-06-2012, 07:55 AM
I just tried in resizable and made it full screen and it works for the most part. The only things that messes up is the position of the Id's on the main screen.

I know it's not meant to be used in resizable mode but I think I'm a pretty cool guy, I test stuff and doesn't afraid of anything.

I disabled resizeable in that DLL. The one on my comp has it enabled. I'll upload it when everything is good.

It's just the difference in byte offsets.

Example the client area in fixed is 765 x 553.

The offset is 224 on the vertical or Stride * I + Pointer.. Where pointer = a pointer to the first vertex.

Resizeable is 800 x 550 or something like that. And the offset is flipped. I have it fixed. Most likely I'll let simba specify an offset or else just detect client size and do it automatically (might be faster).

eska
08-06-2012, 08:05 AM
Just came accross this wierd bug, i was just running around and the main screen zoomed. I got managed to take a screenshot. It then fixed itself after 3-4 seconds.

It's very frequent when you walk around. If you are constanly walking, it should happen at least once every 4-5 minutes.

http://i49.tinypic.com/2ziwizc.jpg


I'ma go check some impressive stuff in the wildy, like lava or idk I'll find something.

Edit: I was heading to the wildy and I noticed that if you have more than one identical item, the ID will not display on all the duplicate ID except the first one.

http://i50.tinypic.com/1zxfet.jpg


Edit2: Lava is lame. Too bad.

Le Jingle
08-06-2012, 08:25 AM
Here's some picks from the updated dll here on page 3, just thought I'd share;
f1/f2/f3/f4/f5, respectively

drizilc
08-06-2012, 09:24 AM
Getting models all vertices & coordinates isn't as easy as storing the pointer from glVertexPointer and iterating through using stride calculations. :)

J J
08-06-2012, 09:39 AM
Your results are getting better and better, keep it up :)

eska
08-06-2012, 11:18 AM
Messing with your source, trying to make it compile as a dll. Damn I'm so lost lol. Time to go to bed though.

Mat
08-06-2012, 11:43 AM
:o, This is looking sick last time I really checked was a few weeks back.
Brandon you are doing loads ! +Rep <3
Mat

Brandon
08-06-2012, 03:05 PM
Getting models all vertices & coordinates isn't as easy as storing the pointer from glVertexPointer and iterating through using stride calculations. :)

I know.. I was testing it a while back. I have to store all the data from the VBO which I left out of the source completely.


GL_EXPORT __stdcall void GLHook_glBufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage)
{
if (BufferBound && CurrentBuffer.Type == target && target == GL_ARRAY_BUFFER)
{
BufferBound = false;
CurrentBuffer.Size = size; //use size and data pointer here.. I took it out.
CurrentBuffer.Usage = usage;
ListOfBuffers.push_back(CurrentBuffer);
}
(*optr_glBufferDataARB) (target, size, data, usage);
}


Every time it stores new data, I grab it. And btw, yes it is as easy as storing the pointer. Sometimes it isn't NULL and when it isn't null, I CAN use it to get the vertices. I've tried it already.


EDIT: Fixed the multiple items bug. I forgot to reset the vertex count. Thanx :)

eska
08-07-2012, 12:24 AM
I like to mess around with stuff to understand how it works so I tried to compile your code into a simple win32 dll using VS2010 but I'm having trouble, I get 400+ errors. 95% of those are fake because they're in gl.h but still I'm not sure if I'm including all the file I'm supposed to or if you removed some source code. So far I only fixed 2 (I download glext.h because it wasn't in my computer).

In my project solution I included the following files:



Commands.hpp
GlHook.hpp
Matrix.hpp
Models.hpp
RSHooks.hpp
Vector3D.hpp
Commands.cpp
GLHook.cpp
main.cpp
Matrix.cpp
Models.cpp
RSHooks.cpp
Vector3D.cpp

It's the first time I try to make a dll in c++ (I've only done it in c# in the past).

What am I missing?

Brandon
08-07-2012, 01:25 AM
I like to mess around with stuff to understand how it works so I tried to compile your code into a simple win32 dll using VS2010 but I'm having trouble, I get 400+ errors. 95% of those are fake because they're in gl.h but still I'm not sure if I'm including all the file I'm supposed to or if you removed some source code. So far I only fixed 2 (I download glext.h because it wasn't in my computer).

In my project solution I included the following files:



Commands.hpp
GlHook.hpp
Matrix.hpp
Models.hpp
RSHooks.hpp
Vector3D.hpp
Commands.cpp
GLHook.cpp
main.cpp
Matrix.cpp
Models.cpp
RSHooks.cpp
Vector3D.cppIt's the first time I try to make a dll in c++ (I've only done it in c# in the past).

What am I missing?


The code on the Github uses G++ Backend not MSVC. So you can compile it with Codeblocks, Mingw, G++, etc.. I have a visual studio 2012 version on my comp somewhere I'll upload it later.. I'm working on getting character positions atm:


LOWEST ANGLE:


GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99975264, 0.0091297952, -0.020280767, 0}
{0, 0.91186345, 0.41049367, 0}
{0.022241013, -0.41039214, 0.9116379, 0}
{1819.2891, -308.66016, 5129.084, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99975264, 0.0091297952, -0.020280767, 0}
{0, 0.91186345, 0.41049367, 0}
{0.022241013, -0.41039214, 0.9116379, 0}
{1819.2891, -308.66016, 5129.084, 1}


GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99990994, 0.0055096098, -0.01223895, 0}
{0, 0.91186345, 0.41049367, 0}
{0.013421912, -0.41045669, 0.91178131, 0}
{255.48047, -56.457031, 4179.0703, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99990994, 0.0055096098, -0.01223895, 0}
{0, 0.91186345, 0.41049367, 0}
{0.013421912, -0.41045669, 0.91178131, 0}
{255.48047, -56.457031, 4179.0703, 1}



GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99977756, 0.0086575896, -0.019231817, 0}
{0, 0.91186345, 0.41049367, 0}
{0.021090677, -0.41040236, 0.91166061, 0}
{248.38477, -85.074219, 4242.6367, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99977756, 0.0086575896, -0.019231817, 0}
{0, 0.91186345, 0.41049367, 0}
{0.021090677, -0.41040236, 0.91166061, 0}
{248.38477, -85.074219, 4242.6367, 1}



GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}


HIGHEST ANGLE:

GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}





GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99997616, 0.0060372208, -0.0033470246, 0}
{0, 0.48486927, 0.87458664, 0}
{0.006902942, -0.87456578, 0.48485771, 0}
{3551.2305, 297.58008, 5957.9141, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99997616, 0.0060372208, -0.0033470246, 0}
{0, 0.48486927, 0.87458664, 0}
{0.006902942, -0.87456578, 0.48485771, 0}
{3551.2305, 297.58008, 5957.9141, 1}

NEW POSITION:

GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99997616, 0.0027075345, -0.0063497927, 0}
{0, 0.91986758, 0.39222905, 0}
{0.006902942, -0.39221969, 0.91984564, 0}
{-281.65234, -45.993164, 4131.0254, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99997616, 0.0027075345, -0.0063497927, 0}
{0, 0.91986758, 0.39222905, 0}
{0.006902942, -0.39221969, 0.91984564, 0}
{-281.65234, -45.993164, 4131.0254, 1}


LOWEST ANGLE: Old Position
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99960816, 0.010978992, -0.02574827, 0}
{0, 0.91986758, 0.39222905, 0}
{0.027991278, -0.39207536, 0.91950715, 0}
{249.30078, -64.625977, 4174.7188, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99960816, 0.010978992, -0.02574827, 0}
{0, 0.91986758, 0.39222905, 0}
{0.027991278, -0.39207536, 0.91950715, 0}
{249.30078, -64.625977, 4174.7188, 1}





http://i.imgur.com/DWk5f.pnghttp://i.imgur.com/s0a0U.pnghttp://i.imgur.com/UGayT.png



The matrices you see corresponds to these views.. I attempting to get the camera position and look at from them all OR character position in the entire scene or world if possible with my limited knowledge on matrices.






EDIT: So.. with my limited knowledge of the Camera/Look-At matrix, I'm unable to get camera position/Look-At and therefore unable to get character position. If only I knew matrices and stuff a bit better then I'd have reflection walking down. The idea behind it was to hook the camera and grab camera data so that it simulate CWI. AKA Console walk which was invented by Home. Reason being is that every position in the GL world would be unique. Aka TILES! Just like reflection.

Anyway I won't give up on it but Tile walking is out of the question for now as I'm not smart enough ={ Sorry. Though I will keep my progress in the code as it's extremely hard to start over and I've gotten soooooo close.

Anyway here is the good news.. I've hooked all Vertex Buffers.. Well.. Most. Not all YET. Something is a bit iffy with my algorithm for grabbing the data. I think I'm using hte stride wrong. But anyway, for models with 24 stride it works flawlessly as you can see:

http://i.imgur.com/Ybg49.png
http://i.imgur.com/fZF7g.png


Now as I already said, my algorithm is a bit off so it isn't displaying all the vertices. It seems like it's skipping a few but the DOTS are the vertices. I know this because when I change the offset, it moves the ID location to my character's Beard. If I change it more, it points at the head and when I set it lower, it points at the legs or the middle of the tile on which I stand. It uses extreme pointers lol. It will get anyone lost easily so I won't be posting it on the git any time soon until I clean up or something.

Inother words, the amount of pointer inceptions used will make a sane man go mad trying to read it. I may use a nested reserved vector of pointers instead.

EDIT2: Removed Exporting Symbols from the g++ version. Also fixed a pointer going beyond array boundaries. Do not use the old versions.

EDIT3: I'm going to have to slow down on the vertex buffer.. Meaning I'll be making buffer hooks optional. If I don't, it'll display way too many vertices. Thus if Disabled, it'll return the vertex of the middle of the model + the boundaries it lies in. If enabled, it returns ALL vertices which might lag you like mad!

EDIT4: I've been ask to post a picture as proof that vertex hooking is possible.. On GameDev & stackoverflow and all the big names, I was told it was impossible. Silabsoft's code comment says there is no way to grab it. Tribot doesn't have it either.. Well here is picture proof.

http://i.imgur.com/85Dwf.png


My projection of them are a bit off but it works pretty flawless. Thus I've changed my mind and I will include vertex hooks + Middle Hooks. In other words, You can grab any point on an object AND you can grab the center point. I feel this is better than giving you guys the boundaries. If I give Simba a list of points, it will be much easier on the Simba side to just to TPABounds or something to get the boundaries (IF you ever need that anyway, most likely not).

Brandon
08-08-2012, 09:04 PM
Oh I've also converted the entire project to support three compilers. Codeblocks, Mingw, and MSVC (All versions). I had to remove C++11 style code though.

So does anyone have a good idea of generating ID's for a vertex buffer or should I stick with what I had in mind?

This is probably the last step before I move on to porting it. I've given up on the Camera matrices so far.. I may come back to that IF I conquer my math background. I believe I'm pretty strong in math atm but it is never enough! 2 Weeks of matrices being self-taught just doesn't cut it.

Anyway if you guys have an idea of how I should checksum the vertex buffer, please let me know or else I'm going to stick to my own algorithm.

Basically you're given a size and a void* pointer to a vertex buffer (buffer that contains all vertices for a model) then generate an ID from that.

I may provide 3 ID's. My own and I'll finally take a look at how Silab did it and maybe implement that too.


Ohhh here is a nice one using my object filter:

http://i.imgur.com/3Yrdk.png

eska
08-08-2012, 09:49 PM
I don't think you will get much help if you don't put it more simple. There might be some awesome math guy around here but he might not understand all that opengl stuff you are referering to.

This is what most of us probably understand from your posts:
"Ok so brandon grab some opengl stuff data (lots of point and stuff), and then he want to use some mathematic formula on that data to know where the camera is (or is looking?), and then some more math to know where the player is."

Brandon
08-08-2012, 09:56 PM
I don't think you will get much help if you don't put it more simple. There might be some awesome math guy around here but he might not understand all that opengl stuff you are referering to.

This is what most of us probably understand from your posts:
"Ok so brandon grab some opengl stuff data (lots of point and stuff), and then he want to use some mathematic formula on that data to know where the camera is (or is looking?), and then some more math to know where the player is."

I'm going to edit this post soon. Basicaly, I'm going to sumarise what I understood (or not) of your last 2-3 posts.


Oh no no.. LOL I gave up on the Camera stuff for now so don't worry about the math. I'm saying:


Given a buffer with a pointer to data + the size in bytes, what's a good algorithm to use to generate ID's. That can't possibly be that hard to understand.. well I don't think?Besides there REALLY isn't any other way I can explain it or break it down..
If you want to help on camera stuff then you'd need to know: http://en.wikipedia.org/wiki/Rotation_matrix

and: https://docs.google.com/viewer?a=v&q=cache:cwEG3qVre3wJ:people.hsc.edu/faculty-staff/robbk/Coms331/Lectures/Lectures%25202011/Lecture%25207%2520-%2520The%2520Modelview%2520Matrix.pdf+&hl=en&gl=ca&pid=bl&srcid=ADGEESh6nXiNeKi0kFaIq5BVPDqcP5XHKAf8eNxBb1vI wbeO5LHk_sK3PeIOJU436jeISY9HAiYVjQmnSr11YhL3dI_6c_ LBRMNGsZaZacm2nNkl6jjf4DzNKz-ynLd_zgG_ipV3YwFf&sig=AHIEtbTyxowPXOGojjff_VGL841LUdjuDQ

And that's worst than I explained..

EDIT: Here is how a vertex buffer may look:
http://i.imgur.com/aCjXY.png

Sirenia
08-08-2012, 10:00 PM
I wished I atleast understood what you are trying to tell us, look great for what I know :P Hope you will keep the nice work up :)
Edit: Clicked the rotation link from wikipedia and saw this http://en.wikipedia.org/wiki/File:Rotation_decomposition.png
If you learn this then you have done ur homework well!

eska
08-08-2012, 10:08 PM
Given a buffer with a pointer to data + the size in bytes, what's a good algorithm to use to generate ID's. That can't possibly be that hard to understand.. well I don't think?
Nah I understand that. What I didn't understand was all that positioning stuff using the camera.

Brandon
08-08-2012, 10:14 PM
Nah I understand that. What I didn't understand was all that positioning stuff using the camera.

I was going to save that explanation for a tutorial. Only posted what I had in case someone understood what those matrices were.

Camera rotation works like this:

Projection Matrix defines the view/clipping area. That's basically how much you can see on the screen at one time. The distance you can see, etc.

ModelView Matrix is two matrices combined. You use this + Projection matrices to convert from 2D to 3D and back. I've provided all the matrices needed to get the camera position but it simply isn't possible to reverse/split a matrix.

Using the two matrices, by rotating, translating, inversing and transposing, it's possible to get the camera location and use that to get the look-at. Aka eye coordinates.

Example: The model view is the view matrix + Model matrix combined. You cannot split them. If I could then I'd have camera position.

Instead, I have to some how use the modelview matrix + projectionview matrix and hooks to get the camera position. I've already provided the source for all the hooks needed but still it puzzles me how anyone could possibly get the camera position. Now there is a program calld GLIntercept which has a plugin called FreeCam. This plugin is opensource and it is able to get the camera position by some insane mathematics. I've tried and given up on even bothering to understand it at this point in time. It's beyond matrices. It's called Quaternions.

Anyway all the info needed to get camera position is what that post was showing. I didn't expect anyone to know what it was or just reverse it magically because that really really isn't possible (for me at least) atm. Lets just say the amount of math required atm isn't worth it for anyone to start learning from scratch. I admire game programmers now. The amount of work is ridiculous.

The other stuff was just progress reports n stuff.

I'm going to go bother benland for an algorithm or do some of research or something.

Gala
08-09-2012, 01:59 PM
I was going to save that explanation for a tutorial. Only posted what I had in case someone understood what those matrices were.

Camera rotation works like this:

Projection Matrix defines the view/clipping area. That's basically how much you can see on the screen at one time. The distance you can see, etc.

ModelView Matrix is two matrices combined. You use this + Projection matrices to convert from 2D to 3D and back. I've provided all the matrices needed to get the camera position but it simply isn't possible to reverse/split a matrix.

Using the two matrices, by rotating, translating, inversing and transposing, it's possible to get the camera location and use that to get the look-at. Aka eye coordinates.

Example: The model view is the view matrix + Model matrix combined. You cannot split them. If I could then I'd have camera position.

Instead, I have to some how use the modelview matrix + projectionview matrix and hooks to get the camera position. I've already provided the source for all the hooks needed but still it puzzles me how anyone could possibly get the camera position. Now there is a program calld GLIntercept which has a plugin called FreeCam. This plugin is opensource and it is able to get the camera position by some insane mathematics. I've tried and given up on even bothering to understand it at this point in time. It's beyond matrices. It's called Quaternions.

Anyway all the info needed to get camera position is what that post was showing. I didn't expect anyone to know what it was or just reverse it magically because that really really isn't possible (for me at least) atm. Lets just say the amount of math required atm isn't worth it for anyone to start learning from scratch. I admire game programmers now. The amount of work is ridiculous.

The other stuff was just progress reports n stuff.

I'm going to go bother benland for an algorithm or do some of research or something.

Correct me if I am wrong, but the only goal is to get the camera position? Quaternions don't seem to be that complicated, perhaps you should have a look at complex numbers in 2D. I am sure I could help with math, but I have no idea about hooking/interception. I just don't understand anything about pointers and ids you are talking about, tbh :p

Brandon
08-09-2012, 02:05 PM
Correct me if I am wrong, but the only goal is to get the camera position? Quaternions don't seem to be that complicated, perhaps you should have a look at complex numbers in 2D. I am sure I could help with math, but I have no idea about hooking/interception. I just don't understand anything about pointers and ids you are talking about, tbh :p

My goal atm is to just generate ID's for the models. As for the camera, well.. that's another story. It is hard. Try programming a class to rotate, transpose, translate, etc.. It's not the same as on pen and paper. Then also implementing it is another process. Yeah the goal was to get the position and look-at but I'm skipping that for now.

Anyway I've written the Simba plugin. It works atm. Just not sure how to pass arrays to simba as it cannot read pointers -__-

ReadySteadyGo
08-09-2012, 02:32 PM
Hi Brandon

Looking good mate!

Just though I'd share my hook for getting compass angle. It's messy but very simple.

I stripped silentwolf's version as a base for mine as I had trouble compiling yours. :( Anyway it should be easy enough to implement in your code.


// globals
bool GettingCompassAngle;
int CompassVertexCount;
int CompassDeltaX;
int CompassDeltaY;
float CompassAngle = 0.;

void sys_glBindTexture (GLenum target, GLuint texture)
{
// 0x84F5 = GL_TEXTURE_RECTANGLE
if(target == 0x84F5) {
GLint textureWidth, textureHeight;
glGetTexLevelParameteriv(GL_TEXTURE_RECTANGLE_ARB, 0, GL_TEXTURE_WIDTH, &textureWidth);
glGetTexLevelParameteriv(GL_TEXTURE_RECTANGLE_ARB, 0, GL_TEXTURE_HEIGHT, &textureHeight);

if (textureWidth == 51) {
if (textureHeight == 51) {
//add_log("Found the compass %d", currentPossibleItem->texture_id);
GettingCompassAngle = true;
CompassVertexCount = 0;
}
}
....

void sys_glVertex2f (GLfloat x, GLfloat y)
{
if(GettingCompassAngle) {
if (CompassVertexCount == 0) {
CompassDeltaX = x;
CompassDeltaY = y;
}
if (CompassVertexCount == 3) {
CompassDeltaX = x - CompassDeltaX;
CompassDeltaY = y - CompassDeltaY;
}
CompassVertexCount++;
}
....

void sys_glEnd (void)
{
if(GettingCompassAngle) {
GettingCompassAngle = false;
CompassAngle = atan2f(CompassDeltaY, CompassDeltaX) * 180 / M_PI;
if (CompassAngle < 0)
CompassAngle = 360 + CompassAngle;
add_log("COMPASS ANGLE = %f", CompassAngle);
}
....

EDIT: Sorry I didn't realize you'd already done this :)

Wizzup?
08-09-2012, 02:42 PM
This is great. Keep it up, I might join in if time permits me to. :)

Brandon
08-09-2012, 03:04 PM
Hi Brandon

Looking good mate!

Just though I'd share my hook for getting compass angle. It's messy but very simple.

I stripped silentwolf's version as a base for mine as I had trouble compiling yours. :( Anyway it should be easy enough to implement in your code.


// globals
bool GettingCompassAngle;
....EDIT: Sorry I didn't realize you'd already done this :)

I just tried your code in a Copy of the dll just so that I don't mess up what I have, when your compass gets upside down, North facing south, your code resets it to 0.

ReadySteadyGo
08-09-2012, 03:32 PM
Makes sense :(

Can be fixed by checking which vert is higher when CompassAngle = 0.

Just stick with what you have if it works though :)

drizilc
08-09-2012, 03:51 PM
I haven't looked at the source but it's probably because textures are normally upside down, so 0 is south. Is the angle also 0 when facing north?

I've also been working on a opengl bot for past few months. I'll make my own thread soon showing some of my stuff.

Brandon
08-09-2012, 03:54 PM
I haven't looked at the source but it's probably because textures are normally upside down, so 0 is south. Is the angle also 0 when facing north?

I've also been working on a opengl bot for past few months. I'll make my own thread soon showing some of my stuff.

It's because his algorithm compared the change in slope. It needs to compare texture position to a static point. That way you can tell how much it has rotated. Then use the slope to get the angle which is what I did. I actually had to get pen and paper out to do it lol. Spent a while trying to figure out why it was doing that too :)

drizilc
08-09-2012, 04:00 PM
Heh, everyone has their own way of doing things. My implementation was based on textures corner positions.


Shared some of my stuff here http://villavu.com/forum/showthread.php?t=88235

Le Jingle
08-09-2012, 07:55 PM
Do you have to gather item id's? As in, when using OpenGL, you gather id's as you find them, then record them; or can you grab them all at once, and store them after grabbing them all at once. Obviously the 2nd way would be much faster, however I was wondering if the 2nd way is possible or if collecting id's needs to be done as in the first way. I may also be getting ahead of myself (;