View Full Version : Direct-X Plugin (Beta)
Brandon
12-22-2013, 12:03 AM
I did say I would release a beta plugin for SMART for Direct-X hooks..
Well, today (2015-05-23) is the day I release the very first beta test -- Speed test.
This beta is specifically for testing speed while the plugin gathers data AND renders on the screen. Although, in reality you won't be rendering ALL ID's on screen while botting (you usually only render ID's when gather info to write the script.. not while running it), I need to test the speed while the ID's are all on screen so that I know how to handle rendering on different computers and what to tweak/redo/fix/patch..
Here goes:
26015
Place it in the Simba plugin folder. Run:
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
begin
SetupSRL;
end.
Enter Direct-X mode and you should see a bunch of ID's on screen. Log in and you should see model ID's on screen.. Ex:
http://i.imgur.com/YtEuDK7.png
http://i.imgur.com/c8tJLfK.png
What I need (test on a dummy account if you can):
Does it draw for you? Can you see IDs?
FPS while all of this is on screen. Is it laggy? Is it responsive? Is it fast? What is the average FPS you're getting? Are your computer's specs good?
Is the font right? Is it blurry?
Is it crashing? Do you get a Java log with the crash report?
Is there missing textures or models?
Is there two EXACTLY the same models different IDs?
Justin
12-22-2013, 12:16 AM
Nice work Brandon, I'll give this a test for sure
Works perfect for me, and direct-x runs a hell of a lot better than openGL. :D
(srl6 code for anyone)
{$DEFINE SMART}
{$i srl-6/srl.simba}
var
bmp: integer;
begin
smartPlugins := ['d3d9.dll'];
setupSRL();
bmp := bitmapFromClient(0, 0, getClientBounds().x2 -1, getClientBounds().y2 -1);
debugBitmap(bmp);
freeBitmap(bmp);
end.
Awesome. And it's not restricted to RS!
I have a question, I wanted to take a screenshot from a game and show it in debug window.
First I do:
DXISetup(gamePID);
And now there is a function DXIImagePointer() which returns Pointer. But how to convert this PointerToImage to Simba type bmp ?
Brandon
12-28-2013, 12:02 AM
Awesome. And it's not restricted to RS!
I have a question, I wanted to take a screenshot from a game and show it in debug window.
First I do:
DXISetup(gamePID);
And now there is a function DXIImagePointer() which returns Pointer. But how to convert this PointerToImage to Simba type bmp ?
Procedure TGraphics.Create(Width, Height: Integer; Ptr: Uint32); overload
Begin
Self.__Bmp.Init(Client.GetMBitmaps);
Self.__Bmp.SetPersistentMemory(Ptr, Width, Height);
Self.__Init := True;
Self.__Width := Width;
Self.__Height := Height;
Self.__Bmp.SetTransparentColor(0);
Insert(@Self, __Bmp__Pointers);
AddOnTerminate('__TGraphicsFreeAll');
End;
The above is from GitHub. Bmp is a TMufasabitmap and to get an int from it, then it's Bmp.GetIndex.
Can't type much. I'm replying from my phone. You just need to do init, set persistent memory, get index then free when done.
Clarity
12-28-2013, 02:17 AM
Wow...this solves several OpenGL related issues for me such as the random zoom in glitch, thank you very much.
Procedure TGraphics.Create(Width, Height: Integer; Ptr: Uint32); overload
Begin
Self.__Bmp.Init(Client.GetMBitmaps);
Self.__Bmp.SetPersistentMemory(Ptr, Width, Height);
Self.__Init := True;
Self.__Width := Width;
Self.__Height := Height;
Self.__Bmp.SetTransparentColor(0);
Insert(@Self, __Bmp__Pointers);
AddOnTerminate('__TGraphicsFreeAll');
End;
The above is from GitHub. Bmp is a TMufasabitmap and to get an int from it, then it's Bmp.GetIndex.
Can't type much. I'm replying from my phone. You just need to do init, set persistent memory, get index then free when done.
Thanks, I tried it but then I found with whatever PID I use DXISetup() , pointers are the same. I guess it's because game doesn't use your d3d9.dll at all!
How to force game to load this file instead of windows/system32 one? In your OpenGL tutorial you wrote about placing .dll in the game folder, but if we move it out of Simba/plugins folder would DXI.dll be still able to communicate with it?
I'm also not sure where to put it, because I'm targeting Unity Web Player :/
Brandon
01-03-2014, 04:56 AM
Thanks, I tried it but then I found with whatever PID I use DXISetup() , pointers are the same. I guess it's because game doesn't use your d3d9.dll at all!
How to force game to load this file instead of windows/system32 one? In your OpenGL tutorial you wrote about placing .dll in the game folder, but if we move it out of Simba/plugins folder would DXI.dll be still able to communicate with it?
I'm also not sure where to put it, because I'm targeting Unity Web Player :/
DXI.dll can communicate with the d3d9.dll no matter where it is. It uses a shared-memory-map. The memory map id never changes.
It would help if I knew what game it was. Yes it is the same as the OpenGL plugin. You just place it in the application's folder.
Like GLXSetup, DXISetup also should return a boolean telling you whether it was loaded successfully. If it returns false, the other application did not "successfully" load the plugin.
Many many things can cause this, such as placing it in the wrong folder, wrong process id (PID), static linkage, etc..
DXI.dll can communicate with the d3d9.dll no matter where it is. It uses a shared-memory-map. The memory map id never changes.
Didn't know that. I will read more about it :)
It would help if I knew what game it was. Yes it is the same as the OpenGL plugin. You just place it in the application's folder.
Like GLXSetup, DXISetup also should return a boolean telling you whether it was loaded successfully. If it returns false, the other application did not "successfully" load the plugin.
Many many things can cause this, such as placing it in the wrong folder, wrong process id (PID), static linkage, etc..
I've placed it in firefox folder, same place where plugin-container.exe is. Now I'm sure it's loaded because I can't delete it when game is running (my way of checking:P).
Now pointers seems to change when I setup game's (actually plugin-container) PID, but image is empty (black). Maybe something is wrong with my code?
program new;
{$loadlib DXI}
var Pr:TSysProcArr;
var bmp : integer;
var TMB :TMufasaBitmap;
var P :Pointer;
begin
while true do
if iskeydown(VK_F1) then
begin
bmp := CreateBitmap(1,1);
TMB := GetMufasaBitmap(bmp);
// writeln(GetProcesses());
writeln(DXISetup(10880));
writeln(DXIImagePointer());
writeln(DXIDebugPointer());
P := DXIImagePointer();
TMB.SetPersistentMemory(LongInt(P),1024,768);
bmp := TMB.GetIndex;
// DisplayDebugImgWindow(1025,769);
// DrawBitmapDebugImg(bmp);
writeln(CreateBitmapString(bmp));
wait(1000);
TMB.ResetPersistentMemory;
TMB.Free;
end;
end.
The game is: http://www.kongregate.com/games/tfender/contract-wars
Brandon
01-03-2014, 01:11 PM
Didn't know that. I will read more about it :)
The game is: http://www.kongregate.com/games/tfender/contract-wars
Updated OP. It should now WORK with the browser properly for any and all games!
See the pictures on the OP :)
The script I used to test it was:
{$loadlib DXI}
Function PtrToBmp(Width, Height: Integer; Ptr: Pointer): Integer;
var
Bmp: TMufasaBitmap;
Begin
Bmp.Init(Client.GetMBitmaps);
Bmp.SetPersistentMemory(Uint32(Ptr), Width, Height);
Bmp.SetTransparentColor(0);
Result := Bmp.GetIndex();
End;
Procedure DebugBitmap(Bmp: Integer);
var
W, H: Integer;
Begin
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
Bmp: Integer;
W, H: Integer;
begin
GetClientDimensions(W, H); //this line requires that you drag the crosshairs on the window.
if (DXISetup(1388)) then //change the this value to whatever the message box shows LAST!
begin
writeln('DXI setup succeeded');
Bmp := PtrToBmp(W, H, DXIImagePointer());
DebugBitmap(Bmp);
FreeBitmap(Bmp);
end else
writeln('Failed to setup DXI.');
end.
And all I did was place the d3d9.dll plugin in the Chrome/Firefox installation folder. I also have an injector written if you don't want to place it in the folder. Does the same thing but it's more difficult to inject into chrome and firefox child tabs! So yeah, placing it in the folder is the easiest option atm until I get around to writing some more code..
It is a test plugin so feedback is appreciated.
Updated OP. It should now WORK with the browser properly for any and all games!
See the pictures on the OP :)
And all I did was place the d3d9.dll plugin in the Chrome/Firefox installation folder. I also have an injector written if you don't want to place it in the folder. Does the same thing but it's more difficult to inject into chrome and firefox child tabs! So yeah, placing it in the folder is the easiest option atm until I get around to writing some more code..
It is a test plugin so feedback is appreciated.
Awesome Brandon, works like a charm! Finally this game has an option to make screenshot in fullscreen mode :P
Are you planning to add more features like in OGL plugin?
@Edit
Well, it worked in menu at least :P But when I join a room, after map is loaded, Unity crash, everytime.
http://puu.sh/682pN.png
webplayer_win.dll caused an Integer Divide by Zero (0xc0000094)
in module webplayer_win.dll at 001b:0588ba22.
Brandon
01-03-2014, 02:14 PM
Awesome Brandon, works like a charm! Finally this game has an option to make screenshot in fullscreen mode :P
Are you planning to add more features like in OGL plugin?
:D Glad it works :D That's is always good news! There really hasn't been very many testers for this plugin.. So I am glad.
I really have no problem adding features in the DXI plugin. It took me what? A couple hours to make this plugin and 5 mins to add browser/smart support? Hooks won't be so hard, same as OpenGL. Testing is what takes time because there usually isn't very many testers or there is usually something that happens on someone else's system that doesn't happen on the developer's. So far I haven't seen any Direct-X bugs at all, unlike the OpenGL ones (and the code is the same :l).
However, the GLX plugin hasn't really seen much usage so I am hesitant to put effort into creating a hook plugin. At the time of creating this plugin, I only had in mind colour only..
Direct-X api is actually just as easy for me as OpenGL api (DX may be even easier and better for hooks). Usage or probably the amount of requests would change my mind. If more people want that then sure I'll add it but as of this exact moment, I'm undecided.
As for the regular features that all graphics plugins must have, yes this plugin already has drawing on the client, it just isn't in use/enabled yet.
Ashaman88
01-03-2014, 03:40 PM
idk what I've done! So put the plugins in my plugin folder - ran the following (& included srl6)
smartPlugins := ['d3d9.dll'];
SetupSRL;
smart loads up but the screen is constantly flashing between
http://puu.sh/6863s.png
and the login screen (yes I'm in directx mode).
What have I done!
Testing is what takes time because there usually isn't very many testers or there is usually something that happens on someone else's system that doesn't happen on the developer's.
I can test it for you, as I'm interested in it.
So far I haven't seen any Direct-X bugs at all, unlike the OpenGL ones (and the code is the same :l).
See my edit in post above:P I'm curious if it happens to you too.
As for the regular features that all graphics plugins must have, yes this plugin already has drawing on the client, it just isn't in use/enabled yet.
Just drawing would be awesome. I could make custom aiming mark :P I've done it before with my ETL, but it can't work in fullscreen mode.
Brandon
01-03-2014, 04:46 PM
I can test it for you, as I'm interested in it.
See my edit in post above:P I'm curious if it happens to you too.
Just drawing would be awesome. I could make custom aiming mark :P I've done it before with my ETL, but it can't work in fullscreen mode.
I haven't tried entering a room. It says: caused an Integer Divide by Zero in web_unity module. I'm curious at to whether this happens only with this plugin?
@Asha, your plugin isn't even loaded. Notice the Smart buttons say "Disable Capture". If the plugin was loaded, Smart would say "Disable Direct-X" on a button. You are loading it wrong somehow. I'm not familiar with SRL-6's api.
I haven't tried entering a room. It says: caused an Integer Divide by Zero in web_unity module. I'm curious at to whether this happens only with this plugin?
Yes, it always and only happens when your d3d9.dll is in browser folder.
idk what I've done! So put the plugins in my plugin folder - ran the following (& included srl6)
This works fine for me.
{$DEFINE SMART}
{$i srl-6/srl.simba}
var
bmp: integer;
begin
smartPlugins := ['d3d9.dll'];
setupSRL();
bmp := bitmapFromClient(0, 0, getClientBounds().x2 -1, getClientBounds().y2 -1);
debugBitmap(bmp);
freeBitmap(bmp);
end.
idk what I've done! So put the plugins in my plugin folder - ran the following (& included srl6)
smartPlugins := ['d3d9.dll'];
SetupSRL;
smart loads up but the screen is constantly flashing between
http://puu.sh/6863s.png
and the login screen (yes I'm in directx mode).
What have I done!
did u managed to resolve this? I got the same problem.
edit: runescape is fine when I disable smart, but enabled it's causing me epileptic seizures (i don't have epilepsia, don't worry :) )
(called it the same way as Olly)
edit: Brandon; cheeky mention, in case you missed it.
I'm not sure why the plugin isn't loading for you guys.. Couldn't work better for me. :s
Brandon
There's this annoying pop up when starting Smart with the DX plugin. It doesn't serve much purpose...
http://puu.sh/6oXNC.png
Sjoe
Can you try this...?
{$loadlib libsmartremote}
var
params: TStringArray;
begin
params := explode(',', between('<iframe id="game" src="', '"', getPage('http://www.runescape.com/game.ws?j=1')));
if (not fileExists(PluginPath+'d3d9.dll')) then
begin
writeln('NO PLUGIN!@!@@!@');
terminateScript();
end;
smartSpawnClient('java.exe', stringReplace(PluginPath, '\', '/', [rfReplaceAll]), params[0], ',' + params[1], 800, 600, '', '', '', 'd3d9.dll');
end.
And see if the plugin successfully loads? (you will see a disable direct-x button).
Ashaman88
01-20-2014, 11:31 PM
you don't want me to try it? I see how it is.
I'll try it too when I get home tonight
you don't want me to try it? I see how it is.
I'll try it too when I get home tonight
O YEA! it didn't work for you either!
Brandon
01-21-2014, 12:37 AM
still flashing for me :(
What is actually printed in your Smart console? If you don't have it showing, add: "smartShowConsole := true;" right before calling "setupSRL".
Then try loading it, copy paste everything into here.. I need to see everything..
As for the popup riwu, it was added so that someone could see that it actually loaded.. It will of course be removed.
Brandon
01-21-2014, 12:44 AM
doesn't seem to print anything on smart?
and what it's doing on debug is waiting for RS to load.
used this to test, if there's somethign wrong with it.
What is this.. This isn't Smart's console :S That's Simba's debug box.. Smart's console HAS to print something. It doesn't print "Nothing" at all. Even when Smart crashes, it prints something.
doesn't seem to print anything on smart?
and what it's doing on debug is waiting for RS to load.
In the console that appears!
I don't see a console lol
http://i.imgur.com/Db1i8r3.png
You sure!?¬!
http://i.imgur.com/Db1i8r3.png
You sure!?¬!
ah , thought there was something else that has to pop up.
http://puu.sh/6sjIh.png
Brandon
01-21-2014, 01:33 AM
ah , thought there was something else that has to pop up.
Actually NOT sure why your Smart says "d3d9.dll not loaded" and yet it at the same time says: "d3d9.dll has no INIT method".. and it has an Init method:
LIBRARY "d3d9.dll" BASE=0x0000000069640000
DESCRIPTION "D3D9 Definition File"
EXPORTS
D3DPERF_BeginEvent = DXHook_D3DPERF_BeginEvent @1
D3DPERF_EndEvent = DXHook_D3DPERF_EndEvent @2
D3DPERF_GetStatus = DXHook_D3DPERF_GetStatus @3
D3DPERF_QueryRepeatFrame = DXHook_D3DPERF_QueryRepeatFrame @4
D3DPERF_SetMarker = DXHook_D3DPERF_SetMarker @5
D3DPERF_SetOptions = DXHook_D3DPERF_SetOptions @6
D3DPERF_SetRegion = DXHook_D3DPERF_SetRegion @7
DebugSetLevel = DXHook_DebugSetLevel @8
DebugSetMute = DXHook_DebugSetMute @9
Direct3DCreate9 = DXHook_Direct3DCreate9 @10
Direct3DCreate9Ex = DXHook_Direct3DCreate9Ex @11
Direct3DShaderValidatorCreate9 = DXHook_Direct3DShaderValidatorCreate9 @12
PSGPError = DXHook_PSGPError @13
PSGPSampleTexture = DXHook_PSGPSampleTexture @14
SMARTPluginInit @15
bool SmartDebugEnabled = false;
bool SmartDirectXEnabled = true;
void SMARTButtonPressed(int ID, bool State)
{
switch(ID)
{
case 100:
if (State)
{
SmartGlobal->setCapture(false);
SmartDirectXEnabled = true;
}
else
{
SmartGlobal->setCapture(true);
SmartDirectXEnabled = false;
}
break;
case 101:
SmartDebugEnabled = State ? false : true;
break;
}
}
extern "C" void SMARTPluginInit(SMARTInfo* ptr, bool* ReplaceButtons, int* ButtonCount, char*** ButtonText, int** ButtonIDs, _SMARTButtonPressed* ButtonCallback)
{
SmartGlobal = ptr;
if (ptr)
{
*ReplaceButtons = true;
char** ButtonTexts = new char*[2];
ButtonTexts[0] = const_cast<char*>("Disable Direct-X_Enable Direct-X");
ButtonTexts[1] = const_cast<char*>("Enable Debug_Disable Debug");
int* IDs = new int[2];
IDs[0] = 100;
IDs[1] = 101;
*ButtonCount = 2;
*ButtonText = ButtonTexts;
*ButtonIDs = IDs;
*ButtonCallback = &SMARTButtonPressed;
}
}
Exact same code as in the OpenGL plugin.. It is practically impossible for the plugin NOT to be loading at all.. It exports everything Smart requires with the correct calling convention. In fact, if this plugin fails, so should OpenGL and that means SRL-6 is broken.. But yet that works :S I know I haven't made a mistake in the code; I just copy pasted my Smart headers from the OpenGL project into the DirectX project.
Another thing is that if the game fails to find an export, it will do: MessageBox(nullptr, e.what(), "ERROR!", 0); which will show which export failed to load.. I don't think you are getting any popups?
The only thing I can think of is something may be wrong on your end?
Brandon
01-21-2014, 01:51 AM
Actually NOT sure why your Smart says "d3d9.dll not loaded" and yet it at the same time says: "d3d9.dll has no INIT method".. and it has an Init method:
LIBRARY "d3d9.dll" BASE=0x0000000069640000
DESCRIPTION "D3D9 Definition File"
EXPORTS
D3DPERF_BeginEvent = DXHook_D3DPERF_BeginEvent @1
D3DPERF_EndEvent = DXHook_D3DPERF_EndEvent @2
D3DPERF_GetStatus = DXHook_D3DPERF_GetStatus @3
D3DPERF_QueryRepeatFrame = DXHook_D3DPERF_QueryRepeatFrame @4
D3DPERF_SetMarker = DXHook_D3DPERF_SetMarker @5
D3DPERF_SetOptions = DXHook_D3DPERF_SetOptions @6
D3DPERF_SetRegion = DXHook_D3DPERF_SetRegion @7
DebugSetLevel = DXHook_DebugSetLevel @8
DebugSetMute = DXHook_DebugSetMute @9
Direct3DCreate9 = DXHook_Direct3DCreate9 @10
Direct3DCreate9Ex = DXHook_Direct3DCreate9Ex @11
Direct3DShaderValidatorCreate9 = DXHook_Direct3DShaderValidatorCreate9 @12
PSGPError = DXHook_PSGPError @13
PSGPSampleTexture = DXHook_PSGPSampleTexture @14
SMARTPluginInit @15
bool SmartDebugEnabled = false;
bool SmartDirectXEnabled = true;
void SMARTButtonPressed(int ID, bool State)
{
switch(ID)
{
case 100:
if (State)
{
SmartGlobal->setCapture(false);
SmartDirectXEnabled = true;
}
else
{
SmartGlobal->setCapture(true);
SmartDirectXEnabled = false;
}
break;
case 101:
SmartDebugEnabled = State ? false : true;
break;
}
}
extern "C" void SMARTPluginInit(SMARTInfo* ptr, bool* ReplaceButtons, int* ButtonCount, char*** ButtonText, int** ButtonIDs, _SMARTButtonPressed* ButtonCallback)
{
SmartGlobal = ptr;
if (ptr)
{
*ReplaceButtons = true;
char** ButtonTexts = new char*[2];
ButtonTexts[0] = const_cast<char*>("Disable Direct-X_Enable Direct-X");
ButtonTexts[1] = const_cast<char*>("Enable Debug_Disable Debug");
int* IDs = new int[2];
IDs[0] = 100;
IDs[1] = 101;
*ButtonCount = 2;
*ButtonText = ButtonTexts;
*ButtonIDs = IDs;
*ButtonCallback = &SMARTButtonPressed;
}
}
Exact same code as in the OpenGL plugin.. It is practically impossible for the plugin NOT to be loading at all.. It exports everything Smart requires with the correct calling convention. In fact, if this plugin fails, so should OpenGL and that means SRL-6 is broken.. But yet that works :S I know I haven't made a mistake in the code; I just copy pasted my Smart headers from the OpenGL project into the DirectX project.
Another thing is that if the game fails to find an export, it will do: MessageBox(nullptr, e.what(), "ERROR!", 0); which will show which export failed to load.. I don't think you are getting any popups?
The only thing I can think of is something may be wrong on your end?
Try this:
{$loadlib libsmartremote}
var
params: TStringArray;
begin
params := explode(',', between('<iframe id="game" src="', '"', getPage('http://www.runescape.com/game.ws?j=1')));
if (not fileExists(PluginsPath+'d3d9.dll')) then
begin
writeln('NO PLUGIN!@!@@!@');
terminateScript();
end;
smartSpawnClient('C:/Program Files (x86)/Java/jre7/bin/java.exe', stringReplace(PluginPath, '\', '/', [rfReplaceAll]), params[0], ',' + params[1], 800, 600, '', '', '', 'd3d9.dll');
end.
The only thing I can think of is something may be wrong on your end?
I'm running srl6 on a vm if this matters?
edit: tried the code, no avail.
Brandon
01-21-2014, 01:55 AM
I'm running srl6 on a vm if this matters? edit: tried the code, no avail.
Weird.. Nothing working? How odd. I ran it in a VM (Hyper-V) worked just fine. Ran it on my comp, it worked just fine as well..
If it failed, no matter what you should see a popup at least once. Try it on your actual comp? Can you get into DirectX normally without the plugin on your VM? Through the browser or through Smart?
Weird.. Nothing working? How odd. I ran it in a VM (Hyper-V) worked just fine. Ran it on my comp, it worked just fine as well..
If it failed, no matter what you should see a popup at least once. Try it on your actual comp? Can you get into DirectX normally without the plugin on your VM? Through the browser or through Smart?
Yeah I can get on DirectX without a problem on the vm, i'll edit this post. gonna try on comp.
But I think Ashaman88; also ran it on his comp(he had the same flickering issue)
edit: same problem on my comp hmm, what could I be doing wrong?
Brandon
01-21-2014, 02:13 AM
Yeah I can get on DirectX without a problem on the vm, i'll edit this post. gonna try on comp.
But I think Ashaman88; also ran it on his comp(he had the same flickering issue)
Don't worry about the flickering.. It only flickers because you told Smart you'd be loading a plugin and Smart thinks you're lying since it isn't seeing any plugins.. Thus it begins to flicker because it isn't capturing any colours and you'll need to disable capturing to stop the flickering. It was designed this way on purpose and it comes in handy to let users know when it is working properly.
That is what the plugin does.. Well it's the job of the plugin to enable capture..
Try something else, place the d3d9.dll into C:/Program Files (x86)/Java/jre7/bin then run Smart regularly with no plugins.. Leave "DXI.dll" in C:/Simba/Plugins.. Switch Smart to DirectX mode. This should FORCE load the plugin from the jre7/bin automatically because it has no other choice but to load the first d3d9.dll found..
Your script should look like this (you should see a popup when Smart loads.. give it a roughly 25 seconds for good measure (in case your comp is slow?).. sometimes the popup is behind smart or on the task bar where "3" is written because it shows 3 smart tabs.. your smart screen should turn black after getting to the login screen! and it will only show colours when you close the popup.. This is a sign that the plugin was indeed loaded and working):
http://i.imgur.com/d8CAPDm.png
Ashaman88
01-21-2014, 02:20 AM
I'll try it out when I get home as well
Don't worry about the flickering.. It only flickers because you told Smart you'd be loading a plugin and Smart thinks you're lying since it isn't seeing any plugins.. Thus it begins to flicker because it isn't capturing any colours and you'll need to disable capturing to stop the flickering. It was designed this way on purpose and it comes in handy to let users know when it is working properly.
That is what the plugin does.. Well it's the job of the plugin to enable capture..
Try something else, place the d3d9.dll into C:/Program Files (x86)/Java/jre7/bin then run Smart regularly with no plugins.. Leave "DXI.dll" in C:/Simba/Plugins.. Switch Smart to DirectX mode. This should FORCE load the plugin from the jre7/bin automatically because it has no other choice but to load the first d3d9.dll found..
Your script should look like this (you should see a popup when Smart loads.. give it a roughly 25 seconds.. sometimes the popup is behind smart or on the task bar where "3" is written because it shows 3 smart tabs.. your smart screen should turn black after getting to the login screen! and it will only show colours when you close the popup.. This is a sign that the plugin was indeed loaded and working):
ok, doesn't get black for me (just flickers).
incase u need to check.
http://puu.sh/6spbO.png
Brandon
01-21-2014, 02:22 AM
ok, doesn't get black for me (just flickers).
incase u need to check.
http://puu.sh/6spbO.png
It is flickering because you are still telling it to "look for d3d9.dll".. Copy the exact script in my post above (from the image above)..
Notice the "smartPlugins := []". You are doing it wrong because that screenshot you have here says "Native button 0:101 not found". That means you are still asking Smart to load the plugin instead of forcefully loading it via jre7/bin as described above.
It is flickering because you are still telling it to "look for d3d9.dll".. Copy the exact script in my post above (from the image above)..
Notice the "smartPlugins := []". You are doing it wrong because that screenshot you have here says "Native button 0:101 not found". That means you are still asking Smart to load the plugin instead of forcefully loading it via jre7/bin as described above.
I used this script to test
program new;
{$DEFINE SMART}
{$I srl-6/srl.simba}
{$loadlib DXI}
begin
smartplugins := [];
SetupSRL;
if (dxisetup(__smartcurrentpid)) then
writeln('ok');
end.
and I did put the plugin in java bin (and removed it from c:\simba\plugins)
edit:
http://puu.sh/6spv5.png
Brandon
01-21-2014, 02:27 AM
I used this script to test
program new;
{$DEFINE SMART}
{$I srl-6/srl.simba}
{$loadlib DXI}
begin
smartplugins := [];
SetupSRL;
if (dxisetup(__smartcurrentpid)) then
writeln('ok');
end.
and I did put the plugin in java bin (and removed it from c:\simba\plugins)
Hmm.. well that's just weird now. Your smart says "I am looking for a plugin's native button and not finding any" even though you're saying that you are not giving it any.. Something is wrong here.. Are you sure you are running "that script" and no other because your smart is saying otherwise and I really cannot figure out where you are going wrong? If you want I can teamviewer you and see why your Smart says that.. Up to you. But if you really are doing everything right, Smart shouldn't be lying like that. Sjoe;
Hmm.. well that's just weird now. Your smart says "I am looking for a plugin's native button and not finding any" even though you're saying that you are not giving it any.. Something is wrong here.. Are you sure you are running "that script" and no other because your smart is saying otherwise and I really cannot figure out where you are going wrong?
Yeah it's the only script i'm running
Brandon
01-21-2014, 03:55 AM
Solved it.. I finally solved it.. Had to make a custom library loader.
Before I start my long post, please note that you will not and should not try anything mentioned in this particular post as it is intended for me and it is only being posted so I don't forget how to solve it when I finish school tomorrow..
Here's the thing. Apparently, if you are trying to use Direct-X and your drivers did NOT install d3dx9_43.dll which ships with Microsoft 9.0c User-End Runtime (NOT developer!!), the plugin will try to load d3dx9_43.dll which is NOT on your system..
This means that no matter what, the plugin will not give an error for this because it simply isn't aware that your system is missing files required to run Direct-X (Especially since I compile with gcc and not MSVC which auto-includes these).. The only way is for me to actually make the plugin try to load this file first.. If it finds it, you're fine, if it doesn't, it will complain. Not sure if I want to do this.. It is however only 1-3 lines of code (just an if statement).
Anyway, I had to make a loader which was doing:
#include "Platforms.hpp"
#include <iostream>
int main()
{
if (xLoadLibrary("C:/Simba/Plugins/d3d9.dll"))
{
std::cout<<"d3d9.dll loaded just fine!!";
}
return 0;
}
This is what actually printed the error. It printed "d3dx9_43.dll is missing from your computer........". I was surprised Smart did NOT print this or give any other details other than "failed to load.".. Not only that but Smart actually loads plugins this exact way! Probably the Java side that try-catches it.. Not sure.
Anyway, for this reason, I will be bundling the plugin WITH d3dx9_43.dll for users who are missing files on their computer (which shouldn't be happening but just in case because I had enough of a hard time solving it today)..
Note: If it works for you, you don't need it.. otherwise you'll either need to fix your drivers OR if your drivers are fine, then you need to install direct-x 9.0c End-User runtime.. Otherwise you'll need it. It's much easier than installing anything..
Anyway, good night for now.. I'll see if I can upload the file tomorrow or something (or statically link to d3d9x if a static-lib exists). This is why we have beta testing and need more.. =)
Note: This post is just for knowledge so I don't forget st00f and so that next time I check here again I'll remember what I have to do.. Please do not install or try anything mentioned in this particular post! It is for me..
Brandon
01-24-2014, 11:39 AM
..
https://github.com/Brandon-T/DXI/releases/tag/v0.1
All bugs fixed so far.. Only thing left I guess is to Draw Smart's mouse and do the speed improvements for drawing..
Ashaman88
01-24-2014, 11:34 PM
https://github.com/Brandon-T/DXI/releases/tag/v0.1
All bugs fixed so far.. Only thing left I guess is to Draw Smart's mouse and do the speed improvements for drawing..
flashing with latest plugin
http://puu.sh/6wTix.png
I'll follow the steps above this post next
Edit: updated drivers and still flashing
Edit2: Downloaded that direct-x 9.0c End-User runtime dealio
works now!
http://puu.sh/6wUFP.png
Godless
01-25-2014, 01:07 PM
Can't seem to get it to work with anything... The actual Plugin is working and is loading RS in Direct X, but scripts will not do anything. What have I overlooked?
Unfortunately I cannot use OpenGL at all. The lag is ridiculous when I am using SMART, so this is my only option. :(
Brandon
01-25-2014, 02:34 PM
Can't seem to get it to work with anything... The actual Plugin is working and is loading RS in Direct X, but scripts will not do anything. What have I overlooked?
Unfortunately I cannot use OpenGL at all. The lag is ridiculous when I am using SMART, so this is my only option. :(
Fix you graphics settings. If you got it working an loading then the only problem left is for you to fix your graphic settings in RS.
Godless
01-25-2014, 02:57 PM
Fix you graphics settings. If you got it working an loading then the only problem left is for you to fix your graphic settings in RS.
It isn't my graphics. For some reason it'll log in on OpenGL but not Direct X.
Maybe something is different with the login screens from ogl/direct-x. il look into it.
Maybe something is different with the login screens from ogl/direct-x. il look into it.
For me it logged the character in to ingame. But got stuck there :(
So wasn't detecting isLoggedIn ingame.
Ashaman88
01-25-2014, 04:12 PM
I have a 10hr proggy going using the directx plugin.. so you guys are cray
I have a 10hr proggy going using the directx plugin.. so you guys are cray
hmm, strange. U didn't have to modify anything?
Ashaman88
01-25-2014, 05:03 PM
hmm, strange. U didn't have to modify anything?
Just change the smartplugins thing before setupsrl
Just change the smartplugins thing before setupsrl
very odd. y it no work for me :(
Wu-Tang Clan
01-25-2014, 07:26 PM
flashing with latest plugin
http://puu.sh/6wTix.png
I'll follow the steps above this post next
Edit: updated drivers and still flashing
Edit2: Downloaded that direct-x 9.0c End-User runtime dealio
works now!
http://puu.sh/6wUFP.png
Can you tell me how to download that stuff from edit2?
I'm getting flashing screen
EDIT: NVM I found it by Copy/Pasting the direct-x 9.0c End-User into google.
Brandon
01-25-2014, 08:58 PM
Ok everyone who cannot get it working, try this: 22785
First run /bin/TestD3D9.
If it says you're good, you're good. Otherwise it will give you an error, you're going to need to tell me that error that it gives you.
Wu-Tang Clan
01-25-2014, 10:51 PM
Ok everyone who cannot get it working, try this: 22785
First run /bin/TestD3D9.
If it says you're good, you're good. Otherwise it will give you an error, you're going to need to tell me that error that it gives you.
http://puu.sh/6y37I.png
I downloaded directx 9.0c and stuff...
Brandon
01-25-2014, 11:16 PM
http://puu.sh/6y37I.png
I downloaded directx 9.0c and stuff...
22788
Copy that to your Simba/Plugins folder OR the /bin folder where the TestD3D9 is located. Try the Simba plugins folder first. I took that from my SysWOW64 folder. Hopefully that one works for you as I'm on Windows 8.1.
If either one of those work then you're a god send. If it doesn't work, copy it to C:/Windows/SysWOW64 and then run the TestD3D9.. If it works, then I'll have to be shipping the plugin with this.. It seems you are having trouble installing DirectX End User Runtime 9.0c..
It seems Skyrim and other games are having the same problem :S
Same problem as SJoe or whoever it was that I teamviewered.. These problems should NOT be happening at all!
Wu-Tang Clan
01-25-2014, 11:29 PM
22788
Copy that to your Simba/Plugins folder OR the /bin folder where the TestD3D9 is located. Try the Simba plugins folder first. I took that from my SysWOW64 folder. Hopefully that one works for you as I'm on Windows 8.1.
If either one of those work then you're a god send. If it doesn't work, copy it to C:/Windows/SysWOW64 and then run the TestD3D9.. If it works, then I'll have to be shipping the plugin with this.. It seems you are having trouble installing DirectX End User Runtime 9.0c..
It seems Skyrim and other games are having the same problem :S
Same problem as SJoe or whoever it was that I teamviewered.. These problems should NOT be happening at all!
http://puu.sh/6y5Pc.png
I'll test the directx smart now... I'll post in sec
So I still get the flicker, but it seems like SMART still loads OGL and won't go to DirectX in graphics settings... I press directX and it sticks to OGL without me saying to revert.
http://puu.sh/6y6aT.jpg
Brandon
01-25-2014, 11:34 PM
http://puu.sh/6y5Pc.png
I'll test the directx smart now... I'll post in sec
So I still get the flicker, but it seems like SMART still loads OGL and won't go to DirectX in graphics settings... I press directX and it sticks to OGL without me saying to revert.
You are able to get into DirectX normally? On the regular Runescape? Not with Smart or any plugins? Have you tried the SysWOW64?
Wu-Tang Clan
01-25-2014, 11:39 PM
You are able to get into DirectX normally? On the regular Runescape? Not with Smart or any plugins? Have you tried the SysWOW64?
Just did syswow one
http://puu.sh/6y6t1.png
Thats for browser
http://puu.sh/6y6ww.png
Thats for SMART
but now it still is flickering???
Brandon
01-25-2014, 11:44 PM
Just did syswow one
http://puu.sh/6y6t1.png
Thats for browser
http://puu.sh/6y6ww.png
Thats for SMART
but now it still is flickering???
Hmm PM me teamviewer details?
EDIT:
Just teamviewered him. It was working the whole time. Not sure what he was doing wrong (maybe loading Smart wrong?).. I didn't have to fix anything :S
Wu-Tang Clan
01-26-2014, 12:43 AM
Hmm PM me teamviewer details?
EDIT:
Just teamviewered him. It was working the whole time. Not sure what he was doing wrong (maybe loading Smart wrong?).. I didn't have to fix anything :S
I just ran a script and it won't left click anything? It can right click but not left click?
Brandon
01-26-2014, 12:48 AM
I just ran a script and it won't left click anything? It can right click but not left click?
The Direct-X plugin is only to provide colours and cannot affect clicking or other functions in any way. All functions such as clicking and interacting with the game is done via Simba and Smart.
Try this and see:
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
begin
SmartPlugins := ['OpenGL32.dll', 'D3d9.dll'];
SetupSRL;
//Login your character after Smart loads..
MoveMouse(250, 250);
ClickMouse(250, 250, MOUSE_LEFT);
end.
Wu-Tang Clan
01-26-2014, 12:51 AM
The Direct-X plugin is only to provide colours and cannot affect clicking or other functions in any way. All functions such as clicking and interacting with the game is done via Simba and Smart.
Try this and see:
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
begin
SmartPlugins := ['OpenGL32.dll', 'D3d9.dll'];
SetupSRL;
//Login your character after Smart loads..
MoveMouse(250, 250);
ClickMouse(250, 250, MOUSE_LEFT);
end.
Wierd, it doesn't show my red pointer/cursor anymore... I thought the clicks weren't registering because what it was clicking doesn't display a yellow marker upon click.
Brandon
01-26-2014, 01:13 AM
Wierd, it doesn't show my red pointer/cursor anymore... I thought the clicks weren't registering because what it was clicking doesn't display a yellow marker upon click.
https://github.com/Brandon-T/DXI/releases
The last line says it's missing Smart's mouse drawing. That is the only thing keeping me from releasing this plugin as a Non-beta plugin.. That and figuring out a way to make it easier to get working.. I'm thinking of just adding the d3d9x_43.dll together with the plugin so that you guys won't have to install or download anything if your computers are missing it for some reason. Either that or I might start drawing textures with a vertex buffer and a shader but I'm lazy.. Plugin currently uses a SpriteBatch.
Other than that, this plugin does everything the OpenGL one does. Including drawing on Smart.
Wu-Tang Clan
01-26-2014, 01:54 AM
https://github.com/Brandon-T/DXI/releases
The last line says it's missing Smart's mouse drawing. That is the only thing keeping me from releasing this plugin as a Non-beta plugin.. That and figuring out a way to make it easier to get working.. I'm thinking of just adding the d3d9x_43.dll together with the plugin so that you guys won't have to install or download anything if your computers are missing it for some reason. Either that or I might start drawing textures with a vertex buffer and a shader but I'm lazy.. Plugin currently uses a SpriteBatch.
Other than that, this plugin does everything the OpenGL one does. Including drawing on Smart.
So does not having a painted cursor increase my ban candidacy? Or is it irrelevant.
Ashaman88
01-26-2014, 02:54 AM
Using your plugin brandon:
http://puu.sh/6yiCf.png
Also using your plugin.
http://i.imgur.com/hW9Vg8J.png
So does not having a painted cursor increase my ban candidacy? Or is it irrelevant.
If I'm correct the painted cursor is the same thing as when SMART is painted on for a proggy. So Jagex can't see it unless they're remotely viewing your computer. And if they were doing that you're banned regardless of whether SMART has a cursor. :)
Brandon
Would it require a lot of time to implement GetTextures() and GetModels() for the DirectX plugin?
I remember you mentioning that the API is basically the same as OpenGL so it shouldn't take much effort to implement that? All i need is the equivalent of the few primary GLXCore methods.
OpenGL can't be used to make any script that involves long distance travel/teleport/world hop due to the memory leak...
Also will the IDs be the same in DirectX as in OpenGL?
Brandon
01-26-2014, 04:53 AM
So does not having a painted cursor increase my ban candidacy? Or is it irrelevant.
Nope. It does not increase detectability. Smart's mouse is actually drawn over the game's canvas. Another thing about using these plugins is that I can freely insert or remove draw commands from the game and it cannot be detected because Jagex would have to reverse my reversal of OpenGL and debug their own game on the fly. Considering that OpenGL can make well over 10k calls in a single frame and Direct-X can do about the same, this would immediately drop you to 1-fps. Another thing is that they would NOT be able to tell my draw calls apart from their own. Can easily insert a vertex into their buffer and it'd be impossible for them to tell without choking the graphics card. C, C++, and ASM have no reflection.
Anyway, I'm getting too detailed. I'm pretty sure I wrote a tutorial on all of that somewhere..
Using your plugin brandon:
http://puu.sh/6yiCf.png
Very nice!
Also using your plugin.
http://i.imgur.com/hW9Vg8J.png
Looking good but is the chat not being detected a bug? Or part of your script? Or are colours different?
Brandon
Would it require a lot of time to implement GetTextures() and GetModels() for the DirectX plugin?
I remember you mentioning that the API is basically the same as OpenGL so it shouldn't take much effort to implement that? All i need is the equivalent of the few primary GLXCore methods.
OpenGL can't be used to make any script that involves long distance travel/teleport/world hop due to the memory leak...
Also will the IDs be the same in DirectX as in OpenGL?
While it is true that the API's are basically the same (both are C code) and does not take much time to implement (especially now that I have a plugin working and a fairly ok debugger), I'm not sure there is much benefit to me putting in time to implement these as the OpenGL non-colour plugin was NOT accepted or used by any part of SRL. The include lays there pretty much dead. I am aware that it apparently has a leak but I spent hours with Kasi and a ton of pros trying to find what just isn't there in the plugin but in the game itself along with its many glitches. However, I will think about adding it to Direct-X (maybe after I finish the Linux Native OpenGL-Colour plugin so that some of us won't have to use Wine.. Need Simba for Linux from Dgby714 or whoever has it). I'm hoping this plugin replaces the OpenGL one for Windows or at least gets used.
I cannot say whether or not the IDs will be the same without actually implementing it. That'd be silly of me to say because Colours and textures may or may not be the same. To the human eye it could be the same but to a program it may not. I do believe it'd be the same though because colours seem to be the same, however, I cannot guarantee that.
Anyway,
I just added what I call a retard fix to the dll. No I'm not calling you guys retards. I'm calling my fix retarded because it actually embeds D3DX9_43 into the plugin. Calling it like:
if DXIAutoFix(PluginPath) then
writeln('Everything is fine!');
will automatically "detect" if you are missing said file. If you are, it will extract said file from itself into your Simba's plugin folder. That should automatically fix whatever loading/flickering errors you guys seem to be having without any effort at all.. If that does NOT work then next time I will make it extract to your SysWOW64. Anyway, I'm confident it works. Just gotta find someone who has the problem.. *patiently waits*
https://github.com/Brandon-T/DXI/releases/tag/v0.2
Looking good but is the chat not being detected a bug? Or part of your script? Or are colours different?
It's just part of my script. Plays an alarm if new chat is detected. Colours on all utilities/menus are the same, the only noticable variance I've found is in the way water and fishing spots are rendered.
Godless
01-26-2014, 09:42 AM
Hmmm... The Direct X itself is working - no flickering, button is there, etc. I just can't get it work in conjunction with ANY script. I try it with AIO Div and I get a Debug Image at log-in, and that is it. I try it with the Super Heater and it skips the GUI (where I have to enter account details, etc.) and goes straight to the log-in page, but has no details to log-in.
Could I just be using the code wrong?
EDIT -
Tried this:
Ok everyone who cannot get it working, try this: d3d9.zip
Direct X is definitely fine.
Brandon
01-26-2014, 03:35 PM
It's just part of my script. Plays an alarm if new chat is detected. Colours on all utilities/menus are the same, the only noticable variance I've found is in the way water and fishing spots are rendered.
Nice. That means only the shaders are different. Rightfully so since one is HLSL and the other is GLSL.. Thank you for that info.
Hmmm... The Direct X itself is working - no flickering, button is there, etc. I just can't get it work in conjunction with ANY script..
Could I just be using the code wrong?
Direct X is definitely fine.
If your Direct-X is working fine, and nothing else is, it is probably something on your part? Does it work for you in OpenGL mode? Without this information, there isn't really anyway I can help.
If it works in OpenGL and not Direct-X, the only thing I can think of is that colours are different. According to others, the colours are the same though.. :l
Ashaman88
01-26-2014, 04:09 PM
There has been a few times when restarting a script w/o smart open that it will give me the waiting 5 minutes message.. I should have just waited for it to take the screeny but after restarting smart a few times it starts to work again
Godless
01-27-2014, 02:36 AM
Got it working.
tealc
01-27-2014, 04:41 AM
*patiently waits*
Any ideas about this error?
http://puu.sh/6zF7O
Runescape loads DirectX by default, but sometimes it's a little bit glitchy. My graphics card is pretty old, but it has the latest driver. My DirectX version is 9.0c. Windows DirectX diagnostic tool(DXDIAG.EXE) looks normal and it passes all of the direct3d tests.
Brandon
01-27-2014, 05:00 AM
Any ideas about this error?
http://puu.sh/6zF7O
Runescape loads DirectX by default, but sometimes it's a little bit glitchy. My graphics card is pretty old, but it has the latest driver. My DirectX version is 9.0c. Windows DirectX diagnostic tool(DXDIAG.EXE) looks normal and it passes all of the direct3d tests.
You can get into DirectX in RS? Try: http://villavu.com/forum/showthread.php?t=107256&p=1282171#post1282171
If it doesn't work, I'll look into it tomorrow. Gotta sleep. Uhh according to your error though, it is saying it cannot find Direct3DCreate9Ex in your d3d9.dll which is located in SysWOW64 or System32.. I made the plugin "throw" an exception whenever it cannot find a specific function that is almost always called by RS (perhaps not in your case). Perhaps your computer may not need that function and might resort to older functions.
I'll remove the exception throwing if the above doesn't work for you. In the mean time, see if you can send me a copy of your d3d9.dll from sysWOW64 or system32.. It seems very weird that you could possibly be missing that specific function.
tealc
01-27-2014, 05:26 AM
You can get into DirectX in RS?
Yes, but sometimes it does this... http://puu.sh/6zFcd
No need to remove the exception throwing, I just wanted to see if it would work at all. As I said directx mode in browser can be a little glitchy, that probably explains why my game sometimes looks like that. It gets worse on higher graphics settings.
http://puu.sh/6zIEf
http://puu.sh/6zIZQ
http://puu.sh/6zJ2e
http://puu.sh/6zJ77
http://puu.sh/6zJaV
edit:dll http://puu.sh/6zJGr.dll
Godless
01-27-2014, 09:37 AM
If your Direct-X is working fine, and nothing else is, it is probably something on your part? Does it work for you in OpenGL mode? Without this information, there isn't really anyway I can help.
If it works in OpenGL and not Direct-X, the only thing I can think of is that colours are different. According to others, the colours are the same though.. :l
I can run scripts successfully in OpenGL, but it lags so bad that I don't even achieve 50% efficiency. It often lags so bad that I am logged out of RuneScape. Direct X resolves any issues with lag, but I can't seem to get the plug-in to run with any script...
Ashaman88
01-27-2014, 02:20 PM
Thanks again Brandon, I can finally fix up my apeatoll script b/c the zoom thing was killing me !
RlagkRud
01-27-2014, 09:56 PM
Just installed it and it seems to be working!
Thanks a lot! DirectX > OpenGL for sure in terms of smoothness.
That zoom in bug was also very annoying.
Brandon
01-27-2014, 11:01 PM
You're welcomed. Glad to see something working :D
For the others, OpenGL shouldn't be so slow.. I also just updated it a day or two ago. It has linux support for the most part and I fixed a couple bugs in exports for compatibility and to get rid of microsoft's crap. For now, I'm mostly focusing on getting Direct-X ready and what not.
Yes, but sometimes it does this... http://puu.sh/6zFcd
No need to remove the exception throwing, I just wanted to see if it would work at all. As I said directx mode in browser can be a little glitchy, that probably explains why my game sometimes looks like that. It gets worse on higher graphics settings.
http://puu.sh/6zIEf
http://puu.sh/6zIZQ
http://puu.sh/6zJ2e
http://puu.sh/6zJ77
http://puu.sh/6zJaV
edit:dll http://puu.sh/6zJGr.dll
Did you happen to blur those images? Or is that another language that I have never seen (Is your RS running a different language, why is everything out of place)? Just wondering because that is pretty screwed up.. Especially as those images depicted are running in your browser! Extremely messed up?
Anyway, I'll need some time to investigate why your .dll is different from all of ours.. Kinda looks like the same situation with the OpenGL version that BMWxi had.. On the left is mine, on the right is yours:
http://i.imgur.com/rdxqaRg.png I have never ever seen a d3d9.dll NOT export CreateDevice9Ex. That means no matter what, you're unable to load the plugin since that export is missing and that also means that I would have to remove that check and instead check do a double check such as: CreateDevice0 || !CreateDevice9Ex.
Is that Windows XP? Supporting multiple hardware is usually difficult but I managed to do it with OpenGL, pretty sure I could do it with D3D9 but it'd take me a day or two to figure out the difference in your exports and mine as I don't have access to a computer with a d3d9 like yours. I'll figure it out after my homework.. There only seems to be one function difference.
@The other guy who's name did not stick in my head.. Deser something? Uhh see if you can contact me or allow me to teamviewer you and see what is up with you. You say you have it working but scripts won't work for you. That is odd since everyone else who has it working has scripts working. I can check it out if you like. Other than that, I'd be guessing at what is wrong.
tealc
01-28-2014, 12:28 AM
That's the English game on Windows xp. Don't put too much effort into it for me, I'm fine playing in safe mode.
Kinda looks like the same situation with the OpenGL version that BMWxi had..
I remember that, it wouldn't work for me either. I believe my graphics card doesn't support that function either. http://puu.sh/6AIM8
samerdl
01-28-2014, 12:51 AM
Brandon,
Do you play CS portable?
Nice plugin, well done!
Wu-Tang Clan
01-28-2014, 04:56 PM
Nope. It does not increase detectability. Smart's mouse is actually drawn over the game's canvas. Another thing about using these plugins is that I can freely insert or remove draw commands from the game and it cannot be detected because Jagex would have to reverse my reversal of OpenGL and debug their own game on the fly. Considering that OpenGL can make well over 10k calls in a single frame and Direct-X can do about the same, this would immediately drop you to 1-fps. Another thing is that they would NOT be able to tell my draw calls apart from their own. Can easily insert a vertex into their buffer and it'd be impossible for them to tell without choking the graphics card. C, C++, and ASM have no reflection.
Anyway, I'm getting too detailed. I'm pretty sure I wrote a tutorial on all of that somewhere..
Very nice!
Looking good but is the chat not being detected a bug? Or part of your script? Or are colours different?
While it is true that the API's are basically the same (both are C code) and does not take much time to implement (especially now that I have a plugin working and a fairly ok debugger), I'm not sure there is much benefit to me putting in time to implement these as the OpenGL non-colour plugin was NOT accepted or used by any part of SRL. The include lays there pretty much dead. I am aware that it apparently has a leak but I spent hours with Kasi and a ton of pros trying to find what just isn't there in the plugin but in the game itself along with its many glitches. However, I will think about adding it to Direct-X (maybe after I finish the Linux Native OpenGL-Colour plugin so that some of us won't have to use Wine.. Need Simba for Linux from Dgby714 or whoever has it). I'm hoping this plugin replaces the OpenGL one for Windows or at least gets used.
I cannot say whether or not the IDs will be the same without actually implementing it. That'd be silly of me to say because Colours and textures may or may not be the same. To the human eye it could be the same but to a program it may not. I do believe it'd be the same though because colours seem to be the same, however, I cannot guarantee that.
Anyway,
I just added what I call a retard fix to the dll. No I'm not calling you guys retards. I'm calling my fix retarded because it actually embeds D3DX9_43 into the plugin. Calling it like:
if DXIAutoFix(PluginPath) then
writeln('Everything is fine!');
will automatically "detect" if you are missing said file. If you are, it will extract said file from itself into your Simba's plugin folder. That should automatically fix whatever loading/flickering errors you guys seem to be having without any effort at all.. If that does NOT work then next time I will make it extract to your SysWOW64. Anyway, I'm confident it works. Just gotta find someone who has the problem.. *patiently waits*
https://github.com/Brandon-T/DXI/releases/tag/v0.2
Hey brandon, my dxi works perfectly, but my brothers is not. I did exactly what you did but his file is failing to load/initiate. It says dxd9.dll is not working properly. I think your new release is the exact same as the previous one because there is no autoupdateme function like github says there is. Its the same as dxiv1
Brandon
01-28-2014, 04:59 PM
Hey brandon, my dxi works perfectly, but my brothers is not. I did exactly what you did but his file is failing to load/initiate. It says dxd9.dll is not working properly. I think your new release is the exact same as the previous one because there is no autoupdateme function like github says there is. Its the same as dxiv1
It isn't the same: https://github.com/Brandon-T/DXI/blob/master/DXI/main.cpp#L21 https://github.com/Brandon-T/DXI/blob/master/DXI/Utilities.cpp#L50
Wu-Tang Clan
01-28-2014, 05:53 PM
It isn't the same: https://github.com/Brandon-T/DXI/blob/master/DXI/main.cpp#L21 https://github.com/Brandon-T/DXI/blob/master/DXI/Utilities.cpp#L50
So dxiautofix and stuff is inside of dxi.dll? then how do I get to use it if it isn't initiating d3d9.dll in smart?
Brandon
01-28-2014, 09:51 PM
So dxiautofix and stuff is inside of dxi.dll? then how do I get to use it if it isn't initiating d3d9.dll in smart?
Because it isn't for SMART. It is for Simba.
{$loadlib DXI.dll}
begin
if (DXIAutoFix(PluginPath)) then
writeln('Fixed!');
end.
I think you're mixing up Smart and Simba plugins.
This is how ALL simba plugins work. You must load them. It is not a SMART plugin. Smart plugins aren't for the user to touch. There are currently two plugin systems:
Smart plugins and Simba plugins. Smart's plugin system is actually really new. Smart plugins are those that the game requires or plugins that extend Smart's functionality and ability to communicate with Simba.. Then there are Simba plugins which are those that are for scripting or communication. Plugins usually ship in pairs; one simba and one smart plugin. The simba one usually is used to communicate with the Smart one or do some sort of Setup in the background.
Examples: GXL + OpenGL32; DXI + D3D9; LibEGL + LibGLESv2; etc.. etc..
In other words, DXI isn't even needed at all. It is only ever needed if using the d3d9 in the browser or another client or if you need to fix your d3d9. Otherwise you don't need to load it.
Ashaman88
01-29-2014, 12:17 AM
Question Brandon; , would it be possible to have simba/ogl/directx plugins autodetect which graphics mode the current smart window is using, then use that graphics mode plugin automatically? Or is that crazy talk
Brandon
01-29-2014, 12:31 AM
Question Brandon; , would it be possible to have simba/ogl/directx plugins autodetect which graphics mode the current smart window is using, then use that graphics mode plugin automatically? Or is that crazy talk
Well of course. Here's the thing.. If OpenGL colours and Direct-X colours are the same, all you do is load both plugins. Whichever mode your Smart is in, that's the plugin that will be used.. Only problem would be users in Safemode. I personally just load both plugins not caring about which one I'm using..
Ashaman88
01-29-2014, 12:44 AM
Well of course. Here's the thing.. If OpenGL colours and Direct-X colours are the same, all you do is load both plugins. Whichever mode your Smart is in, that's the plugin that will be used.. Only problem would be users in Safemode. I personally just load both plugins not caring about which one I'm using..
That would be awesome to add. However safemode isn't srl6 supported so that wouldn't matter so much (just give the standard 5 minutes no smart error)
And I can confirm no difference:
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| AshamanGGZZLRC v8.06 |
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| Running For: 3 Hours, 29 Minutes and 36 Seconds |
| Ore's Burned: 2,131 Ores/H: 610 |
| Exp Earned: 136,400 Exp/Hour: 39,045 |
|_________________________________________________ __________|
|_________________________________________________ __________|
Clarity
01-29-2014, 01:48 PM
Mouse drawing would be truly awesome, when script testing it's been frustrating sometimes not knowing whether the mouse is doing something totally off. But thanks for this plugin in general, a total life saver for barrows!
Ashaman88
01-29-2014, 02:17 PM
Well of course. Here's the thing.. If OpenGL colours and Direct-X colours are the same, all you do is load both plugins. Whichever mode your Smart is in, that's the plugin that will be used.. Only problem would be users in Safemode. I personally just load both plugins not caring about which one I'm using..
Also Brandon when I load both of the plugins, smartimage.draw whatever doesn't work anymore (but when i load only the directx plugin it does)
Wu-Tang Clan
01-30-2014, 01:25 AM
Just a disclaimer: As soon as I put the D3D9_43.dll into my brothers sysWOW64 (system 32 for you 32 bit people) the plugin worked. It is in your best interest to put that file there. Good luck guys.
Reflector
01-30-2014, 01:48 AM
The plugin loads fine for me but it just sits there with simba saying 'Waiting up to 5 minutes for RuneScape to load ...'
22826
Brandon
01-31-2014, 02:19 PM
Mouse drawing would be truly awesome, when script testing it's been frustrating sometimes not knowing whether the mouse is doing something totally off. But thanks for this plugin in general, a total life saver for barrows!
Yes. I'm working on the mouse drawing stuff. I'll try to get it done today. Got no school.
Also Brandon when I load both of the plugins, smartimage.draw whatever doesn't work anymore (but when i load only the directx plugin it does)
http://i.imgur.com/IEaqywy.jpg
That's both OpenGL and DirectX. However, I did end up finding a bug when BOTH plugins are loaded. Switching modes multiple times while both are loaded stops the OpenGL drawing but DirectX still draws fine when both are loaded.. Guess the pointer gets invalidated in OpenGL. Easy to fix. Might also change the name of the Enable Debug buttons so that you can tell which is which.. OR I can bug Benland to modify the plugin system to give plugins the ability to check if buttons already exist or the ability to remove and add buttons at run-time.. Maybe I'll do it and push it :l I think changing the names would be easiest for now though..
Either way works..
EDIT: Fixed Drawing and button names.
Just a disclaimer: As soon as I put the D3D9_43.dll into my brothers sysWOW64 (system 32 for you 32 bit people) the plugin worked. It is in your best interest to put that file there. Good luck guys.
Will fix. Another work around is to just do DXIAutoFix('C:/Windows/SysWOW64');. Should not have made a difference. I'll make the d3d9.dll load the other .dll explicitly. This way you'll never ever have to mess with your computer's internals. That is the only guaranteed fix. Was just testing the waters in hopes that I'd never have to do that :( Either that or I'll mess with the debug drawing again and draw using vertex/index buffers instead of sprites..
EDIT: Fixed.
The plugin loads fine for me but it just sits there with simba saying 'Waiting up to 5 minutes for RuneScape to load ...'
Check your graphic settings. Here's what I noticed. Even if my graphic settings are correct in OpenGL mode, it does NOT carry over to Direct-X. They are two different modes and you'll have to setup your Direct-X graphic settings to match your OpenGL settings or whatever settings worked for you before this plugin existed.
I don't have a clue why the game is like that but it makes sense I guess.. In other words, if I have the mouse theme disabled in OpenGL, I can have it enabled in DirectX. Pretty cool to me.
footballjds
01-31-2014, 02:28 PM
Thanks again Brandon, I can finally fix up my apeatoll script b/c the zoom thing was killing me !
what zoom thing?
Clarity
01-31-2014, 03:01 PM
what zoom thing?
In OpenGL the game randomly zooms in when you load new areas, and you can't click on anything, which means you're basically stuck for about 6-7 seconds until it reverts back to normal. It's surprising Jagex hasn't fixed this tbh for so long.
e.g. for the barrows script every time you enter a tomb or leave a tomb or enter the tunnels/leave the tunnels or teleport somewhere there's a 6-7 second wait, which adds up to a huge amount of wasted time.
footballjds
01-31-2014, 03:02 PM
In OpenGL the game randomly zooms in when you load new areas, and you can't click on anything, which means you're basically stuck for about 6-7 seconds until it reverts back to normal. It's surprising Jagex hasn't fixed this tbh for so long.
never encountered this
Ashaman88
01-31-2014, 03:24 PM
never encountered this
Go do a lap around the ape atoll agility course, it's pretty ridiculous
And awesome job Brandon keep it up man
The Mayor
01-31-2014, 08:51 PM
This is nice Brandon! the plugin woks great. It looks like all the colors are the same too, so no need to rewrite anything ;) No more minimap disappearing and zoom glitches! Is it possible to have another mouse cursor (apart from the red dot)
The Mayor
02-03-2014, 10:56 AM
The new version or d3d9 I downloaded doesn't seem to draw on SMART, but the old version I had a few days ago did (unless I've somehow mixed them up or something?).
Brandon
02-03-2014, 01:15 PM
The new version or d3d9 I downloaded doesn't seem to draw on SMART, but the old version I had a few days ago did (unless I've somehow mixed them up or something?).
Are you sure? Did it not draw the mouse or anything? If so, I'll check it out again. Maybe I uploaded the wrong dll. Anyway, make sure debug is on. Should look like what's on the main post.
Clarity
02-03-2014, 01:35 PM
With the mouse addition this is perfect, thank you so much man.
Edit: Brandon can confirm the not drawing issue w/ the new dll. DirectX debug is on with no drawing occurring. Used the old plugin minutes ago with no issues.
Brandon
02-03-2014, 02:03 PM
With the mouse addition this is perfect, thank you so much man.
Edit: Brandon can confirm the not drawing issue w/ the new dll. DirectX debug is on with no drawing occurring. Used the old plugin minutes ago with no issues.
So it draws the mouse but not any debug stuff? If that is the case, I need to remove a line of code.
Clarity
02-03-2014, 02:05 PM
So it draws the mouse but not any debug stuff? If that is the case, I need to remove a line of code.
yeah.
http://gyazo.com/9799a2a3fb2cf79335be84d6debe89ba.png
Brandon
02-03-2014, 02:16 PM
yeah.
Very nice! Perfect description. Was hoping it won't be bad. Just gotta move a silly line of code and I'll upload it.. When I get home though. Stuck in this shitty Linux Fedora class doing nothing..
Clarity
02-03-2014, 02:18 PM
Yeah I'm not sure if this is just me, but running my scripts in DirectX is like 10x smoother with much higher FPS. Not sure if this is just the FPS I see vs the FPS SMART sees, but it just looks a ton cleaner. And no more zooming in glitch which means...dungeoneering is coming...
Reflector
02-04-2014, 09:46 AM
Still doesn't work for me... Just sits there waiting for rs to load... I tried each setting no luck :(
All I have to add to my script is this line of code right??
smartPlugins := ['d3d9.dll'];
The Mayor
02-04-2014, 10:21 AM
Still doesn't work for me... Just sits there waiting for rs to load... I tried each setting no luck :(
All I have to add to my script is this line of code right??
smartPlugins := ['d3d9.dll'];
And you actually have to change your graphics settings on rs before you load smart.
Reflector
02-04-2014, 03:31 PM
Tried it... Still not working :( Could it be Java?? When I loaded the game in browser, it said I had an outdated version of Java so is it because of that?
EDIT: Tried re-installing Java and Simba, and the plugin.. Still not working
footballjds
02-04-2014, 07:30 PM
this works great and resolves the minimap issues...
I kind of need debug working though.
Thanks brandon
Tried it... Still not working :( Could it be Java?? When I loaded the game in browser, it said I had an outdated version of Java so is it because of that?
EDIT: Tried re-installing Java and Simba, and the plugin.. Still not working
Well, nobody can help you if you just say 'it's not working'
Brandon
02-05-2014, 01:47 AM
Tried it... Still not working :( Could it be Java?? When I loaded the game in browser, it said I had an outdated version of Java so is it because of that?
EDIT: Tried re-installing Java and Simba, and the plugin.. Still not working
There are currently problems even getting runescape to load.. I personally cannot get SMART into safemode in order to switch graphics modes.. I ended up having to get into safemode on my browser and then switch to directx there.. Then I switched to Smart..
I also got that stupid Java problem as well.. I reinstalled Java like 5 times.. The first 4 times I used java that I downloaded myself.. it failed. I used the one on the RS page when you get that silly notification.. it worked :S
Anyway, I think it was just my Java.. then again, if you even attempt to get into OpenGL mode atm, WITHOUT the plugin, it will freeze and if you try it in Smart, it will print "jaggl Exception in glDeleteTextures".. Not actually sure how the hell Jagex managed to mess up their own OpenGL wrapper.
Just in case some of you were wondering, no it's not my OpenGL plugin which works fine btw.. Why? Because my plugin does NOT use any textures..
So for the guy I'm currently replying to, either wait a while until Jagex fixes the client OR get into safemode in your browser and switch modes from there. As to why SMART won't go into safemode for me, I have NO idea at all..
Yeah I'm not sure if this is just me, but running my scripts in DirectX is like 10x smoother with much higher FPS. Not sure if this is just the FPS I see vs the FPS SMART sees, but it just looks a ton cleaner. And no more zooming in glitch which means...dungeoneering is coming...
this works great and resolves the minimap issues...
I kind of need debug working though.
Thanks brandon
I just installed Java on my friend's laptop to test this plugin.. It is a very slight hardware difference between my laptop and you guys computers.. So my only alternative was to either test on my school computer or a friend's..
Anyway, the difference is pretty retarded.. Basically on my computer, I can let textures auto-delete whenever the game resets the canvas.. However for you guys (including the laptop I tested it on), I must manually delete the texture every frame which means I must also create the texture every frame..
THUS I will NOT be drafting this as a release (on my github that is) because it is a test plugin. I need to make sure it works for all of you before anything more.
Secondly, I need to know if it is slow or laggy when drawing. Why? Because I'm now having to create a texture every frame (just like in OpenGL) and delete it every frame.. For you guys that is. Not sure why myself and Olly who also tested it don't have to do this :S
Anyway, as a temporary fix until I get some "real time" to work on a better fix, use this instead: 22868
It really shouldn't lag as my friend's comp is pretty shit and it doesn't seem to lag at all.
And no, it's not a "bad" fix at all. It's just "temporary" as I don't have enough time to investigate it atm.. Probably will do on the weekend. The above should definitely work though.
For those of you who like to see the different in source:
http://www.diffchecker.com/kjz42ma7
Yes that's right.. a one line difference.. Sorry it took so long to do..
Clarity
02-05-2014, 01:55 AM
Interesting. I wonder if there's some random driver I could download that would fix it. Thanks for the detailed explanation.
Brandon
02-05-2014, 02:00 AM
Interesting. I wonder if there's some random driver I could download that would fix it. Thanks for the detailed explanation.
Most likely not. Seeing as it happened to more than one person with the exception of Olly and myself, I'd say it's just different function calls..
For example, the previous plugin would delete the texture in Proxy::Reset();
But for you guys, it seems that function may not be called.. Well it seems to be called once at the start of loading which is why it drew nothing because it was deleted already.
For us, it wasn't deleted until Smart was closed. That's the difference. Don't bother or worry about drivers or anything. It's just the way the game makes calls and the order it is made in..
Of course, I'll need to debug it to confirm the above (reset not being called by the game itself) but I'll do that on the weekend.. Too much homework and crap to do atm..
Anyway, if you can, let me know if it draws fine for you now. Both mouse & debug.
Clarity
02-05-2014, 02:07 AM
Anyway, if you can, let me know if it draws fine for you now. Both mouse & debug.
Both are working fine now, thanks so much!
http://gyazo.com/0a49a24f47b95b4a2f0e647e1d72a58f.png
Alhtough there are instances where the debug disappears into some kind of blackness (like the everything being drawn turns black/semi transparent and then fades in and out). Not sure if that's just me or not.
Edit: got a pic of the weird semi-transparency:
http://gyazo.com/0fced7095fa9ede22d6ac97174c36703.png
Brandon
02-05-2014, 02:22 AM
Both are working fine now, thanks so much!
Alhtough there are instances where the debug disappears into some kind of blackness (like the everything being drawn turns black/semi transparent and then fades in and out). Not sure if that's just me or not.
Edit: got a pic of the weird semi-transparency.
Cool. Not a problem. Just another one liner again.. Gotta remove:
SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); or set it to FALSE.
I'll do it later. Don't wanna recompile it atm lol. But yeah. No lag or anything though right? Hopefully.
Glad to see it finally working good for you guys though. Thank you for your responses. Really helps and helped a lot! Nice and quick too.
Reflector
02-05-2014, 10:08 AM
Officer Barbrady That's all I get from the debug haha... It says plugin 'd3d9.dll' loaded successfully and my SMART client has the DirectX buttons and all then it says 'Waiting for Runescape to load ...' and the '1 minute has passed ...' and it just continues till 5 minutes and then quits
Brandon All right I'll try that... Thanks! :)
footballjds
02-05-2014, 06:32 PM
Brandon,
I noticed SRL respawned a smart client but it said it never loaded. (it did though) I'm wondering whose bug this is.
(using your temp/latest directX plugin)
Kevin
02-05-2014, 06:56 PM
Just commenting to let you know that I was successfully using the DirectX plugin perfectly fine (after a restart of course, and the one line of plugin change in any script wanting it). Was using the v0.3 - not the latest uncompiled code.
Unrelated to Quality of Life of the current public plugin, is the Import Address Table for functions, objects, or both?
Godless
02-06-2014, 05:54 AM
Still doesn't work for me... Just sits there waiting for rs to load... I tried each setting no luck :(
All I have to add to my script is this line of code right??
smartPlugins := ['d3d9.dll'];
So where in my script do I actually have to place this? Doesn't seem to like it anywhere I put it.
Kevin
02-06-2014, 06:35 AM
So where in my script do I actually have to place this? Doesn't seem to like it anywhere I put it.
Throw it as the first line after the last begin.
Turpinator
02-06-2014, 07:03 AM
That's all I get from the debug haha... It says plugin 'd3d9.dll' loaded successfully and my SMART client has the DirectX buttons and all then it says 'Waiting for Runescape to load ...' and the '1 minute has passed ...' and it just continues till 5 minutes and then quits
sounds like your runescape isnt set to DirectX mode...
Godless
02-06-2014, 09:25 AM
Throw it as the first line after the last begin.
Thank you.
Reflector
02-06-2014, 10:53 AM
sounds like your runescape isnt set to DirectX mode...
But it is... I changed my settings to DirectX using the browser... Entered safe mode and switched to DirectX and then started my script...
slushpuppy
02-06-2014, 03:02 PM
any chance you can get this to work on wine ;P?
Brandon
02-10-2014, 10:44 AM
No Kevin. The IAT table if for functions only. It holds no variables. The VTable can hold variables and functions and the variable can be an object or a pointer to one.
I'll try wine in a sec and see if it works on that.
The Mayor
02-11-2014, 04:57 AM
Cool. Not a problem. Just another one liner again.. Gotta remove:
SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); or set it to FALSE.
I'll do it later. Don't wanna recompile it atm lol. But yeah. No lag or anything though right? Hopefully.
Glad to see it finally working good for you guys though. Thank you for your responses. Really helps and helped a lot! Nice and quick too.
Did you end up recompiling this?
Kevin
02-11-2014, 05:50 AM
No Kevin. The IAT table if for functions only. It holds no variables. The VTable can hold variables and functions and the variable can be an object or a pointer to one.
I'll try wine in a sec and see if it works on that.
Ah, ok. Would you be willing to give a lesson on the basics of IAT and VTables? I tried looking at some of your previous threads, and I see references to them before, however I don't see any in depth explanation of them. Granted I only looked at the first page of posts on the OpenGL thread... None the less, I'm not entirely sure what they are besides some set of information relating to objects and/or functions. Are they [basically] what a pdb is to a typical dll? Or are they far more, granting us the direct access to the functions, as if they were a dll and pdb combined?
Brandon
02-11-2014, 07:08 AM
Did you end up recompiling this?
No I haven't gotten around to recompiling it yet.. Just trying to finish all my school work and stuff.. I'm pretty swamped atm + doing a ton of Objective-C and teaching.. :l
Ah, ok. Would you be willing to give a lesson on the basics of IAT and VTables? I tried looking at some of your previous threads, and I see references to them before, however I don't see any in depth explanation of them. Granted I only looked at the first page of posts on the OpenGL thread... None the less, I'm not entirely sure what they are besides some set of information relating to objects and/or functions. Are they [basically] what a pdb is to a typical dll? Or are they far more, granting us the direct access to the functions, as if they were a dll and pdb combined?
I don't mind writing a tutorial.. I wrote you a short snippet in the last 5 mins + a little more to describe it.. I don't have time atm to format the below into nice bullet and keyword highlighting and stuff so bare with me..
#include <iostream>
#include <windows.h>
class Child
{
public:
virtual void PrintOne() {std::cout<<"PrintOne Called!\n";}
virtual void PrintTwo() {std::cout<<"PrintTwo Called!\n";}
virtual ~Child() {}
};
DWORD* GetVTableAddress(void* pObject)
{
return *reinterpret_cast<DWORD**>(pObject);
}
void HookFunction(DWORD* VTable, void* HookFunc, void* OldFunc, int Index)
{
//Enable writing to the VTable
DWORD OldProtect = 0;
VirtualProtect(&VTable[Index], sizeof(DWORD), PAGE_READWRITE, &OldProtect);
//Save Old Function
*reinterpret_cast<DWORD*>(OldFunc) = VTable[Index];
//Overwrite Address with New Function
VTable[Index] = reinterpret_cast<DWORD>(HookFunc);
//Restore Old Protection
VirtualProtect(VTable, sizeof(DWORD), OldProtect, &OldProtect);
}
void Hooked_PrintOne(void* this_ptr)
{
std::cout<<"Hooked PrintOne Called!\n";
}
void Hooked_PrintTwo(void* this_ptr)
{
std::cout<<"Hooked PrintTwo Called!\n";
}
int main()
{
void (*OldFunc)(void* this_ptr) = NULL; //A function pointer to backup the old class function.
void (*OldFunc2)(void* this_ptr) = NULL; //same thing..
Child* child = new Child();
DWORD* VTable = GetVTableAddress(child);
std::cout<<"Calling child->Print.. (not hooked yet)\n\n";
child->PrintOne();
child->PrintTwo();
HookFunction(VTable, reinterpret_cast<void*>(&Hooked_PrintOne), &OldFunc, 0); //Hook function VTable[0]
HookFunction(VTable, reinterpret_cast<void*>(&Hooked_PrintTwo), &OldFunc2, 1); //Hook function VTable[1]
std::cout<<"----------------------------------------\n\n";
std::cout<<"Calling child->Print.. (hooked)\n\n";
child->PrintOne();
child->PrintTwo();
std::cout<<"----------------------------------------\n\n";
std::cout<<"Calling Original child->Print.. (hooked)\n\n";
OldFunc(NULL);
OldFunc2(NULL);
delete child;
}
In the above, we created a class called Child. Child has two virtual functions. Without the virtual table, child cannot be overriden or inherited from.
Next we created a function to get the VPointer. The VPointer is a pointer to the VTable. The VPointer is always the first 4 bytes of a class unless specified otherwise (in that case it will be the last 4 bytes.. very very rare to see this!).
4 bytes = sizeof(DWORD) or sizeof(std::uint32_t).
After that comes any member functions (functions belonging to the class). These are all 4 bytes in length as well. Our GetVTableAddress function gets the VPointer by first casting the Object/class to a DWORD** pointer. This pointer is then dereferenced to get the VTable (a DWORD* aka array of function addresses).
Next we see the HookFunction. How does it work? Well, lets explain the parameters:
The first parameter it takes is of course the pointer to the VTable which we just got from GetVTableAddress.
Next it wants a pointer to a "hook function".. The custom function we created to override the one inside the class.
After that, it takes a pointer to a function that is the SAME SIGNATURE as the one in the class itself. This pointer will be used to backup the original function so we can either call it or restore it later.
Finally, it takes the index in the VTable of the function we want to hook. Array in C++ start at index 0. Thus it only makes sense that the first function is actually index 0 and the next function is index 1 and so on. Note that they are still 4 bytes apart because we are speaking in terms of DWORDs.
Now for how the HookFunction works. What it does is first it backs up the original protection that the memory has on it. Memory in windows has specific "permissions" or properties that protect it from accidental writing. Because of this, if you try to write to an address not allocated explicitly, you get access violations. However, if you make that memory writable, you may write to it freely without any problems at all.
So any how, we change permissions on the VTable[Index] memory to Read/Write and we store the old protection in our variable. That will be used to restore the original protection when finished (also avoids detectability to an extent).
The next line backs up the Class's function address in OldFunc pointer.
Finally, we overwrite the address in the VTable with the address of our HookFunction. Thus when someone calls the class function, it actually calls our hook function instead.
Lastly, we restore the original protection that the class initially had before we went messing with it.
Ah now comes the Hooked functions..
As we should know by now, classes are just a structure holding a group of functions but what makes a class function different from a regular function?
void Regular_Function(const char* some_string)
{
}
void Class_Function(void* this, const char* some_string)
{
}
void RegularFunc()
{
}
void ClassFunc(void* this)
{
}
The above is the difference between a class function and a regular function. A class function is always passed a pointer to the current instance. That pointer is known as the "this" keyword/pointer in many languages. It is used to access variables of that class's instance.
For this reason, our Hooked functions MUST have the "this" pointer as its first parameter! All other parameters may come after!
The rest is pretty self explanatory..
Advantages? Imagine you have something like d3d9.dll which has 50+ functions.. Do you really want to write a wrapper for all 50 functions even if you are only going to hook one?! (Yes I did that for d3d9.dll.. I know)
The answer is NO. You do NOT typically want to do that. You want to write a VTable Hook function and hook as many functions as you need. Nothing more, nothing less. Less work for you overall and its cleaner and easier to read..
Thus a hook can be a couple lines long.. For example, it can take less than 50 lines of code to hook d3d9's EndScene and get colours.
Disadvantages? Requires a loader whereas a wrapper does not since it emulates the original .dll.
That is about it for VTables.. Not sure if I can really teach you IAT because that requires explaining THUNK's and a whole bunch of disassembling and PE info (Portable Executable knowledge)..
I'll think about writing a proper tutorial later or something.. I really got a lot to do and writing the above killed quite a lot of my free time and its 2:07AM.. I gotta leave for school at 5:30AM (no sleep lmao)
Ashaman88
02-13-2014, 04:47 AM
Hey Brandon... Not sure if it's your plugin or SPS or what... but when I do the following:
1) Make an SPS map (from DirectX or OGL mode) of an "upstairs" area, which has a lot of black on the MM
2) Load both plugins smartPlugins := ['d3d9.dll','OpenGL32.dll'];
3) Set GLX graphics mode
4) Run sps.GetPlayerPOS repeating forever
It always returns -1, -1 (ie not found).
However if I run those same events with the same map, but have rs in OGL mode, it works perfect.
I don't have that issue with ground level maps though so it makes me think it's something to do with the black.
Again my SPS map works in OGL mode but not in GLX, even if I make the map while in GLX mode (however map made in GLX mode WILL work in OGL mode - so it's probs not different colors).
Any ideas/Did that make sense?
Frement
02-13-2014, 06:00 AM
The chunk might be different size in dx mode? Just a thought.
Ashaman88
02-13-2014, 12:47 PM
The chunk might be different size in dx mode? Just a thought.
I confused what do you mean by chunk? Maps made on ground level work fine with both modes
Frement
02-13-2014, 10:37 PM
I confused what do you mean by chunk? Maps made on ground level work fine with both modes
Here are 4 chunks:
http://frement.net/srl/interception/minimap.gif
Brandon
02-13-2014, 10:55 PM
Hey Brandon... Not sure if it's your plugin or SPS or what... but when I do the following:
1) Make an SPS map (from DirectX or OGL mode) of an "upstairs" area, which has a lot of black on the MM
2) Load both plugins smartPlugins := ['d3d9.dll','OpenGL32.dll'];
3) Set GLX graphics mode
4) Run sps.GetPlayerPOS repeating forever
It always returns -1, -1 (ie not found).
However if I run those same events with the same map, but have rs in OGL mode, it works perfect.
I don't have that issue with ground level maps though so it makes me think it's something to do with the black.
Again my SPS map works in OGL mode but not in GLX, even if I make the map while in GLX mode (however map made in GLX mode WILL work in OGL mode - so it's probs not different colors).
Any ideas/Did that make sense?
Uhh I'll have to check it out later.. I got access to nothing for the next 15hours.. On a stupid flight to NYC..
If I had to guess, I'd say the first thing you should do is make sure you are getting colours fine. Try making a bitmapfromclient of the minimap area.
Ashaman88
02-15-2014, 07:49 PM
Uhh I'll have to check it out later.. I got access to nothing for the next 15hours.. On a stupid flight to NYC..
If I had to guess, I'd say the first thing you should do is make sure you are getting colours fine. Try making a bitmapfromclient of the minimap area.
like so?
http://puu.sh/6Xm9z.png
Kevin
02-19-2014, 04:45 PM
...
Many thanks for this! Although, it does bring up other questions: like why did you hook everything in your DirectX wrapper? As for the VTable Wrapper disadvantage, is the only disadvantage in that sense the extra work, or does it add extra processing in the startup that is noticeably significant, or something entirely else?
And please, don't feel any need to stress out or lose sleep over stuff like this... I can be patient, and I'm sure everyone else can be as well, no need to run off 3 hours of sleep instead.
Brandon
02-19-2014, 10:39 PM
Many thanks for this! Although, it does bring up other questions: like why did you hook everything in your DirectX wrapper? As for the VTable Wrapper disadvantage, is the only disadvantage in that sense the extra work, or does it add extra processing in the startup that is noticeably significant, or something entirely else?
And please, don't feel any need to stress out or lose sleep over stuff like this... I can be patient, and I'm sure everyone else can be as well, no need to run off 3 hours of sleep instead.
The wrapper requires everything to be hooked. Hence the word "wrapper". It must export every function that the original .dll exports. Otherwise there can be segmentation faults or simply easy detection.
The VTable is actually "LESS" work than writing a wrapper. The wrapper has way more code. There isn't any performance difference. The reason for the wrapper is to allow Smart to load it. Otherwise it'd have to be injected or loaded as a different name other than d3d9.dll.
As for Ashaman's bug. Is that really the actual minimap? With that one small brown square in the middle? If the colours are indeed correct, the only thing I can think of would be tolerances on the black area. That might not be completely black (0x00000000)
blackalley22
04-15-2014, 09:40 PM
Ok so I want to learn how run a script with directx how do I go about using the plugin where do I save it how do i make a script use it?
Brandon
04-15-2014, 09:42 PM
Ok so I want to learn how run a script with directx how do I go about using the plugin where do I save it how do i make a script use it?
You save the plugin in C:/Simba/Plugins and in the script you do:
smartPlugins := ['d3d9.dll']
blackalley22
04-15-2014, 09:59 PM
You save the plugin in C:/Simba/Plugins and in the script you do:
smartPlugins := ['d3d9.dll']
I have saved the plugin in my plugin folder but how do I save it into a script?
Brandon
04-15-2014, 11:20 PM
I have saved the plugin in my plugin folder but how do I save it into a script?
You don't "Save" plugins into your script. Your script uses them. Smart uses them.
In your script you do:
smartPlugins := ['d3d9.dll']
That will make smart use it.
blackalley22
04-15-2014, 11:55 PM
You don't "Save" plugins into your script. Your script uses them. Smart uses them.
In your script you do:
smartPlugins := ['d3d9.dll']
That will make smart use it.
I'm using Ashaman88's aatole script and when it opens smart it says this -------- Using plugins "d3d9.dll,OpenGL32.dll" but its still spawning the opengl clinpe et if I use directx with the opengl client the script wont work.
Brandon
04-16-2014, 12:21 AM
I'm using Ashaman88's aatole script and when it opens smart it says this -------- Using plugins "d3d9.dll,OpenGL32.dll" but its still spawning the opengl clinpe et if I use directx with the opengl client the script wont work.
I was under the impression that DirectX and OpenGL share the same colours. It should work. You just need to go to settings on the client and switch to DirectX. The only way I see this not working is if colours are different or if you have the plugins in the wrong place.
blackalley22
04-16-2014, 01:11 AM
I was under the impression that DirectX and OpenGL share the same colours. It should work. You just need to go to settings on the client and switch to DirectX. The only way I see this not working is if colours are different or if you have the plugins in the wrong place.
So all I have to do is save the folder into my plugins folder under simba and it should work?
Gunner
04-18-2014, 09:41 PM
Ok, so even dumbass, inept Me got this to work, and in my own script nonetheless. It has greatly reduced CPU usage on 2 of my 4 open clients, (all 4 are using it), my question is, why not I can has all 4 reduced?
The bots that are still at 25% usage have a noticeably lower fps than the 2 that are reduced. 12Fps vs. 40Fps via Alt+~ in the RS window. (See screenshot)
I absolutely LOVE the fact that it has even reduced CPU by this much, however I can't figure out why it wouldn't do it on all open clients. I haven't tried raising or lowering the task manager priorities for the processes, but I can't imagine that would be the reason because I've never touched those for SMART.
I would love to get the total CPU usage down to around 40% so I can stop cooking my CPU at 98%. Even with a water cooler I'm still running at 55C constantly. But lets be real, I'll just run more bots until I'm at 98% again, but hey, it was a nice thought.
So, do you guys have any advice for me? Or is this a mystery to all?
23209
Brandon
04-19-2014, 03:08 PM
So, do you guys have any advice for me? Or is this a mystery to all?
I just did some benchmarks on the simplest d3d9 program:
void D3DX::onUpdate(IDirect3D9* D3D9Ptr, IDirect3DDevice9* D3D9Device)
{
int Width = 0, Height = 0;
HDC DC = nullptr;
RECT rect;
GetClientRect(this->Handle(), &rect);
Buffer.resize((rect.right - rect.left) * (rect.bottom - rect.top) * 4);
D3D9Device->Clear(0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);
D3D9Device->BeginScene();
dxReadPixels(D3D9Device, &Buffer[0], DC, Width, Height, D3DFMT_UNKNOWN);
//Save("C:/Users/Brandon/Desktop/Foo.bmp", &Buffer[0], Width, Height);
D3D9Device->EndScene();
D3D9Device->Present(nullptr, nullptr, nullptr, nullptr);
}
Commenting out dxReadPixels drops CPU usage to 1.7%. Reading pixels from the back-buffer jumps CPU usage to 8-10%.
RS without reading the back-buffer has an average CPU usage of: 9-13% over 1 hour run-time.
RS with the plugin without reading the back-buffer has an average CPU usage of 9-13% over 1 hour run-time.
The above makes sense since the plugin is just a wrapper.
However, when I enable reading, the worst CPU usage I got so far was 15% over a 1 hour span. Sometimes it spiked to 22% for a second or two but dropped back down after. This was for the official RS client in Varrock bank. I'm not sure what made it jump.
All of this was tested in Varrock bank with the official client. I found similar values using SMART.
http://i.imgur.com/r3dbNhv.png
I did not try running multiple clients of any kind as that would have skewed the results. I don't have any ideas why it would go up when running multiple clients but if I had to guess, I'd say it's because each client gets less CPU/GPU time as the amount of clients increase.
Gunner
04-19-2014, 09:19 PM
I did not try running multiple clients of any kind as that would have skewed the results. I don't have any ideas why it would go up when running multiple clients but if I had to guess, I'd say it's because each client gets less CPU/GPU time as the amount of clients increase.
Those are about the same values I get when running a single SMART client as well. I just can't understand why 2 clients would always use >20% and 2 clients would always use <10%. They are running the same script, at the same location. My results are the same today, and I zeroed in on one of the >20% clients and it never dropped below that.
I thought maybe the clients were, as you suggested, spiking to 20% and then settling back to 10%, and the 4 clients we're simply trading spikes to appear like the same 2 were always on top. But after a few minutes of watching, the >20%'s are always that high, and the <10%'s are always that low.
The only thing I can imagine, is the first 2 clients I open run at >10% no matter what. After that, the GPU starts dumping graphical processes to the CPU to make up for the extra load. The next time I launch my clients I'll watch and see exactly in which order they start hogging CPU and report back.
BTW Specs are:
CPU - AMD FX-4100 3.6Ghz
GPU - ATI Radeon HD 4670 1GB
Mobo - Gigabyte GA-970A-D3
RAM - 16GB DDR3
terrmiits
04-24-2014, 09:53 AM
where is the folder i have to place in this plugin to work?
Rogue Sniper
06-28-2014, 07:31 PM
Hey Brandon tryed to get it working for me but no luck. I'm running Windows 8.1 on a Laptop.
TestD3D9 comes back with "Your Direct-X is fine!"
In Client/Browser I can get Dirext-X to run fine. In SMART it just flickers.
Is there any way you'd make a Tutorial on where to put things and settings?
KeepBotting
06-28-2014, 11:47 PM
Hey Brandon tryed to get it working for me but no luck. I'm running Windows 8.1 on a Laptop.
TestD3D9 comes back with "Your Direct-X is fine!"
In Client/Browser I can get Dirext-X to run fine. In SMART it just flickers.
Is there any way you'd make a Tutorial on where to put things and settings?
Make sure you place the plugin in C;/Simba/Plugins
And make sure you're actually running RS on Direct-X mode
If you've got no Direct-X mode option, it's the the plugin, it's your graphics card.
The Mayor
06-29-2014, 12:40 AM
Hey Brandon tryed to get it working for me but no luck. I'm running Windows 8.1 on a Laptop.
TestD3D9 comes back with "Your Direct-X is fine!"
In Client/Browser I can get Dirext-X to run fine. In SMART it just flickers.
Is there any way you'd make a Tutorial on where to put things and settings?
Make sure you place the plugin in C;/Simba/Plugins
And make sure you're actually running RS on Direct-X mode
If you've got no Direct-X mode option, it's the the plugin, it's your graphics card.
and you need to make sure you tell smart to use the plugin too:
smartPlugins := ['openGL32.dll', 'd3d9.dll'];
Rogue Sniper
06-29-2014, 06:03 PM
Thanks for the Help --- RS wasn't in direct-x mode for some reason -- thought that i set it up.
i also didnt have the plugin in the simba/plugins folder
works great now
toxjq
07-25-2014, 09:41 PM
so how do i install the plugin?
Zeta Matt
07-29-2014, 09:23 PM
Thanks for the plugin. It's working better than when I was using the normal smart with OpenGl; I wonder why the normal SMART can't have this as standard...
Can you try this...?
Simba Code:
{$loadlib libsmartremote}
var
params: TStringArray;
begin
params := explode(',', between('<iframe id="game" src="', '"', getPage('http://www.runescape.com/game.ws?j=1')));
if (not fileExists(PluginPath+'d3d9.dll')) then
begin
writeln('NO PLUGIN!@!@@!@');
terminateScript();
end;
smartSpawnClient('java.exe', stringReplace(PluginPath, '\', '/', [rfReplaceAll]), params[0], ',' + params[1], 800, 600, '', '', '', 'd3d9.dll');
end.
And see if the plugin successfully loads? (you will see a disable direct-x button).
This also helped me a lot in figuring out why d3d9.dll wasn't being loaded for me :) Thanks Olly
Zeta Matt
07-29-2014, 09:25 PM
Only problem I've had until now is that SMART becomes the active window whenever the script triggers a clicking procedure... Could annoy a lot in click-intensive scripts. Any ideas on why this happens?
KeepBotting
07-29-2014, 09:30 PM
Only problem I've had until now is that SMART becomes the active window whenever the script triggers a clicking procedure... Could annoy a lot in click-intensive scripts. Any ideas on why this happens?
iirc it's something to do with how your OS interprets SMART's mouse events, only way to stop it is make another window active, and wait till SMART's taskbar icon starts flashing yellow. it shouldn't try and make itself active after that
Zeta Matt
07-29-2014, 10:10 PM
iirc it's something to do with how your OS interprets SMART's mouse events, only way to stop it is make another window active, and wait till SMART's taskbar icon starts flashing yellow. it shouldn't try and make itself active after that
Oh, haven't thought about that. It had become flashing yellow indeed, but I clicked it every time >.> Thanks
Spaceblow
08-08-2014, 09:43 AM
Brandon, thank you very much for this great plugin. When I used OpenGL the minimap always glitched out when I started up the client, now this problem is fixed because I'm using your plugin. :)
alar82
08-13-2014, 03:40 AM
Got some questions. Finally managed to compile vtable.cpp but it comes out as exe. Shoudnt it be a dll? for injection. It does display "Hooked!".
So what do I compile first? What to inject? Does SharedMemory work on those new hooks=?
Brandon
08-13-2014, 06:20 AM
Got some questions. Finally managed to compile vtable.cpp but it comes out as exe. Shoudnt it be a dll? for injection. It does display "Hooked!".
So what do I compile first? What to inject? Does SharedMemory work on those new hooks=?
VTable.cpp is just an example of HOW VTable hooking & detouring works. It is there as a sort of "documentation". I linked to it in some thread that explained the difference between VTable hooking, detouring & wrapping.
In that example/doc, it hooks the Kernel32 function "Sleep" and replaces it with a custom function, "hSleep".
For example, it could hook "Kernel32.Sleep" and replace it with "User32.MessageBoxA" via Detour patching. Everytime you call sleep, it'd show a messagebox. The file doesn't hook Direct-X itself.
https://github.com/Brandon-T/DXI/blob/master/Other%20Hook%20Styles/VTable%20D3D9%20Hook.cpp
^^ That's what you need to compile (VTable hooks) into a .dll.
I know it looks like a tiny bit of code but that little amount of code is equivalent to the entire Direct-X plugin that SRL scripts use. I've already explained somewhere on the forums the difference between the current .dll and the vtable hooks.
Once you compile that, you can use: https://github.com/Brandon-T/DXI/blob/master/Other%20Hook%20Styles/Injector/main.cpp
to inject it into an application.
Is there a reason you want to do this though? You can already inject the current d3d9.dll as well..
alar82
08-13-2014, 08:41 AM
I wanna somehow get texture ids (somewhere is mentioned that vtabel is only way), but really dont know what the hell I am doing. Yeah I see d3d9 has folder hooks.
Can I use d3d9 to draw something to offical client surfcace?
I would use opengl but it seems to be heavily bugged on amd cards. Even color-only version slows down from 40 to 1fps after few teleports.
Heyo got a question for y'all.
Using Brandon's script over here:
{$loadlib DXI}
Function PtrToBmp(Width, Height: Integer; Ptr: Pointer): Integer;
var
Bmp: TMufasaBitmap;
Begin
Bmp.Init(Client.GetMBitmaps);
Bmp.SetPersistentMemory(Uint32(Ptr), Width, Height);
Bmp.SetTransparentColor(0);
Result := Bmp.GetIndex();
End;
Procedure DebugBitmap(Bmp: Integer);
var
W, H: Integer;
Begin
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
Bmp: Integer;
W, H: Integer;
begin
GetClientDimensions(W, H); //this line requires that you drag the crosshairs on the window.
if (DXISetup(1388)) then //change the this value to whatever the message box shows LAST!
begin
writeln('DXI setup succeeded');
Bmp := PtrToBmp(W, H, DXIImagePointer());
DebugBitmap(Bmp);
FreeBitmap(Bmp);
end else
writeln('Failed to setup DXI.');
end.
The process ID that goes in DXISetup is that just the PID you can find in taskmanager?
http://puu.sh/aQNg4/9054db77ed.png
Put 2420 from Dreamseekers PID in there, selected the window, and no go.
What do?
Brandon
08-13-2014, 04:54 PM
I wanna somehow get texture ids (somewhere is mentioned that vtabel is only way), but really dont know what the hell I am doing. Yeah I see d3d9 has folder hooks.
Can I use d3d9 to draw something to offical client surfcace?
I would use opengl but it seems to be heavily bugged on amd cards. Even color-only version slows down from 40 to 1fps after few teleports.
Well that's not true at all.. Yes you can draw to the surface of the official client. Yes you can hook textures but you don't need VTable hooks at all. VTable hooks are useful IFF you want to hook a SINGLE function without having to wrap each and every one. It's usually done for quick hooks.
For example, the current plugin that Smart LOADS hooks every function or else it cannot be loaded. However, a VTable hook can hook 1, 2, 3, 4, 5++.. amount of functions and still work. It doesn't have to hook all and that's an advantage IMO.
To hook textures, you can easily just hook: HRESULT Direct3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture)
Just save pTexture to a buffer. Nice and easy. It should be noted that you could hook other functions such as the render functions and monitor what's happening (shaders, models, textures, etc..).
...
The SRL Direct-X plugins will NEVER work for that. I removed it before (in v0.1; current version is v0.4) because Simba is already able to capture Direct-X windows WITHOUT the plugin (or so I was told). IIRC Cynic also added support for that to Simba. But even without the support, it was able to capture the windows already (again, I was told this). Thus the plugin was only needed for SMART..
For external programs, I use: https://github.com/Brandon-T/DXI/releases/tag/v0.4 VisualStudio.Build.Source.zip.
This allows you to do BOTH SMART, Official Client, & Browsers/External Apps. Why? Because someone emailed me asking for the ability to build the plugin with Visual Studio.
That zip file contains both the source & the plugins themselves (in the Release folder). The plugin is significantly faster (for me at least) and smaller (for everyone) than the SRL one (afaict.. even though there is more code). Turns out Visual Studio is better at this than g++-4.8.1 on Windows.
Also the script I use now is.. It just allows you to clear the screen and shows how to "draw" on other windows.
{$loadlib DXI}
Function PtrToBmp(Width, Height: Integer; Ptr: Pointer): Integer;
var
Bmp: TMufasaBitmap;
Begin
Bmp.Init(Client.GetMBitmaps);
Bmp.SetPersistentMemory(Uint32(Ptr), Width, Height);
Bmp.SetTransparentColor(0);
Result := Bmp.GetIndex();
End;
Procedure DrawBox(Bmp: Integer; Box: TBox; Fill: Boolean = False; Colour: TColor = $FF);
var
TPA: Array Of TPoint;
TM: TMufasaBitmap;
Begin
TM := GetMufasaBitmap(Bmp);
If (Fill) then
TM.Rectangle(Box, Colour)
Else
Begin
TPA := EdgeFromBox(Box);
TM.DrawTPA(TPA, Colour);
End;
End;
Procedure ClearBox(Bmp: Integer; Box: TBox);
Begin
DrawBox(Bmp, Box, True, $0);
End;
Procedure DebugBitmap(Bmp: Integer);
var
W, H: Integer;
Begin
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
Bmp: Integer;
W, H: Integer;
begin
GetClientDimensions(W, H); //this line requires that you drag the crosshairs on the window.
if (DXISetup(9244)) then //change the this value to the PID..
begin
writeln('DXI setup succeeded');
Bmp := PtrToBmp(W, H, DXIImagePointer());
DebugBitmap(Bmp);
FreeBitmap(Bmp);
Bmp := PtrToBmp(W, H, DXIDebugPointer());
ClearBox(Bmp, IntToBox(0, 0, W - 1, H - 1));
DrawBox(Bmp, IntToBox(0, 0, 100, 100));
FreeBitmap(Bmp);
end else
writeln('Failed to setup DXI.');
end.
I had also requested that Dbgy & Olly added the ability to grab a window's handle. I think it goes something like: client.getIOManager.getTarget.getHandle;
Not sure. But that would allow us to do something like: DXISetp(client.getIOManager.getTarget.getHandle); without having to worry about the stupid PID every single time.
Well that's not true at all.. Yes you can draw to the surface of the official client. Yes you can hook textures but you don't need VTable hooks at all. VTable hooks are useful IFF you want to hook a SINGLE function without having to wrap each and every one. It's usually done for quick hooks.
For example, the current plugin that Smart LOADS hooks every function or else it cannot be loaded. However, a VTable hook can hook 1, 2, 3, 4, 5++.. amount of functions and still work. It doesn't have to hook all and that's an advantage IMO.
To hook textures, you can easily just hook: HRESULT Direct3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture)
Just save pTexture to a buffer. Nice and easy. It should be noted that you could hook other functions such as the render functions and monitor what's happening (shaders, models, textures, etc..).
The SRL Direct-X plugins will NEVER work for that. I removed it before (in v0.1; current version is v0.4) because Simba is already able to capture Direct-X windows WITHOUT the plugin (or so I was told). IIRC Cynic also added support for that to Simba. But even without the support, it was able to capture the windows already (again, I was told this). Thus the plugin was only needed for SMART..
For external programs, I use: https://github.com/Brandon-T/DXI/releases/tag/v0.4 VisualStudio.Build.Source.zip.
This allows you to do BOTH SMART, Official Client, & Browsers/External Apps. Why? Because someone emailed me asking for the ability to build the plugin with Visual Studio.
That zip file contains both the source & the plugins themselves (in the Release folder). The plugin is significantly faster (for me at least) and smaller (for everyone) than the SRL one (afaict.. even though there is more code). Turns out Visual Studio is better at this than g++-4.8.1 on Windows.
Also the script I use now is.. It just allows you to clear the screen and shows how to "draw" on other windows.
{$loadlib DXI}
Function PtrToBmp(Width, Height: Integer; Ptr: Pointer): Integer;
var
Bmp: TMufasaBitmap;
Begin
Bmp.Init(Client.GetMBitmaps);
Bmp.SetPersistentMemory(Uint32(Ptr), Width, Height);
Bmp.SetTransparentColor(0);
Result := Bmp.GetIndex();
End;
Procedure DrawBox(Bmp: Integer; Box: TBox; Fill: Boolean = False; Colour: TColor = $FF);
var
TPA: Array Of TPoint;
TM: TMufasaBitmap;
Begin
TM := GetMufasaBitmap(Bmp);
If (Fill) then
TM.Rectangle(Box, Colour)
Else
Begin
TPA := EdgeFromBox(Box);
TM.DrawTPA(TPA, Colour);
End;
End;
Procedure ClearBox(Bmp: Integer; Box: TBox);
Begin
DrawBox(Bmp, Box, True, $0);
End;
Procedure DebugBitmap(Bmp: Integer);
var
W, H: Integer;
Begin
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
Bmp: Integer;
W, H: Integer;
begin
GetClientDimensions(W, H); //this line requires that you drag the crosshairs on the window.
if (DXISetup(9244)) then //change the this value to the PID..
begin
writeln('DXI setup succeeded');
Bmp := PtrToBmp(W, H, DXIImagePointer());
DebugBitmap(Bmp);
FreeBitmap(Bmp);
Bmp := PtrToBmp(W, H, DXIDebugPointer());
ClearBox(Bmp, IntToBox(0, 0, W - 1, H - 1));
DrawBox(Bmp, IntToBox(0, 0, 100, 100));
FreeBitmap(Bmp);
end else
writeln('Failed to setup DXI.');
end.
I had also requested that Dbgy & Olly added the ability to grab a window's handle. I think it goes something like: client.getIOManager.getTarget.getHandle;
Not sure. But that would allow us to do something like: DXISetp(client.getIOManager.getTarget.getHandle); without having to worry about the stupid PID every single time.
Yeah I tried snagging the Simba from http://nala.villavu.com/downloads/directx-tests/ but it won't open on my PC.
64 bit or 32 bit.
I'll check out your plugin though, unless there's another Simba with directX. :')
Brandon
08-14-2014, 03:24 AM
Yeah I tried snagging the Simba from http://nala.villavu.com/downloads/directx-tests/ but it won't open on my PC.
64 bit or 32 bit.
I'll check out your plugin though, unless there's another Simba with directX. :')
I'm not going to ask how you found that or where you got it :S I'll just blame Olly.. but it also doesn't run on my PC as well and so I'll blame Olly again.. lol
I'm not going to ask how you found that or where you got it :S I'll just blame Olly.. but it also doesn't run on my PC as well and so I'll blame Olly again.. lol
wat y!
Brandon
08-14-2014, 03:50 AM
wat y!
Because whenever I have a Simba problem and I'm don't want to bother Dgby, I just bother you or blame you. It makes more sense that way. It just does. It's nature's law of life.
If I need something fixed, I ask you. If I need something added, I ask you and if you say no, I ask dgby and if he says no, I cry every time.. and then make a plugin. Because I ask you first, I will blame you first and then I blame him and then whoever else is on the Simba commit lists. lol. /logic.
I'm not going to ask how you found that or where you got it :S I'll just blame Olly.. but it also doesn't run on my PC as well and so I'll blame Olly again.. lol
Yeah seems like a good idea.
Olly, fix directX pls u borked it.
Nexusop
09-29-2014, 10:19 PM
Brandon, could you do a simple explanation how to export the hooked DX functions to Lape? There doesn't seem to be any documentation for C++ plugins. Thanks.
mrisperfect
01-01-2015, 07:15 PM
I got the direct x plugin to work, but now i am unsure of what I need to put in my scripts to make it use directx instead of Opengl, help please?
P.S it works fine, i just don't know what i have to change to make it use the directx instead of opengl
Brandon
01-01-2015, 07:53 PM
I got the direct x plugin to work, but now i am unsure of what I need to put in my scripts to make it use directx instead of Opengl, help please?
P.S it works fine, i just don't know what i have to change to make it use the directx instead of opengl
SRL-6 should automatically use either one. I think..
If not then you need to do:
smartPlugins := ['d3d9.dll'];
setupSRL;
Then switch the client to Direct-X mode in graphic settings.
mrisperfect
01-01-2015, 08:01 PM
SRL-6 should automatically use either one. I think..
If not then you need to do:
smartPlugins := ['d3d9.dll'];
setupSRL;
Then switch the client to Direct-X mode in graphic settings.
I find that it logs into runescape ok, but once it's fully logged in, it doesn't do anything such as it won't bot or click anything.
P.S Does the simba script have to support directx for me to bot? or i can use any script?
The Mayor
01-01-2015, 08:43 PM
I find that it logs into runescape ok, but once it's fully logged in, it doesn't do anything such as it won't bot or click anything.
P.S Does the simba script have to support directx for me to bot? or i can use any script?
This thread is a little obsolete now because both the openGL and this directX plugin are packaged with srl6, and by default both plugins will be loaded when you spawn a SMART client. You just have to make sure your in game graphics are set to DirectX and it should work.
mrisperfect
01-01-2015, 08:57 PM
This thread is a little obsolete now because both the openGL and this directX plugin are packaged with srl6, and by default both plugins will be loaded when you spawn a SMART client. You just have to make sure your in game graphics are set to DirectX and it should work.
I have it set in directx, and it still don't work unless i use a script that support directx. Is there anyway to use the scripts that are for opengl?
cosmasjdz
01-01-2015, 09:26 PM
I have it set in directx, and it still don't work unless i use a script that support directx. Is there anyway to use the scripts that are for opengl?
Yes, change most colors since they differ alot in some ocasions
Brandon
05-24-2015, 04:06 AM
You can all test now: https://villavu.com/forum/showthread.php?t=107256&p=1276881#post1276881
Report anything missing or unusual.
Don't worry about ID's as they're just there for testing the debugging and not actually generated properly (they are a CRC32 of ALL the pixels in the texture atm or a simple hash of the primitive count in models).
Clarity
05-24-2015, 04:17 AM
You have allowed me to continue what I had previously given up on. Thank you, Brandon.
Brandon, so far, SMART has crashed when attempting to enter Direct X mode. Will try again and edit this post with updates.
Edit: on 2nd attempt, when switching to DX mode while not logged in, it worked!
So far working perfectly, always at 50fps at 800x600. Going to try larger client sizes now. Using a Macbook Pro.
Edit 2: Averaging 40fps at 1920x1200, which is incredible compared to OGL. Thank you!
http://i.gyazo.com/57ee728ff64471c41577e0810a386353.jpg
Brandon
05-24-2015, 04:32 AM
You have allowed me to continue what I had previously given up on. Thank you, Brandon.
Brandon, so far, SMART has crashed when attempting to enter Direct X mode. Will try again and edit this post with updates.
Edit: on 2nd attempt, when switching to DX mode while not logged in, it worked!
So far working perfectly, always at 50fps at 800x600. Going to try larger client sizes now. Using a Macbook Pro.
Excellent. I'll investigate the crash. If you have a log of it, that would be good. If not, it's okay. There's only two possible functions it could have happened in (EndScene or DrawIndexedPrimitive).
Glad the FPS is high though. I didn't test other sizes but it should be roughly the same.
Clarity
05-24-2015, 04:42 AM
Excellent. I'll investigate the crash. If you have a log of it, that would be good. If not, it's okay. There's only two possible functions it could have happened in (EndScene or DrawIndexedPrimitive).
Glad the FPS is high though. I didn't test other sizes but it should be roughly the same.
Could this be the log you are looking for? It contains "j jagdx.IDirect3DDevice.EndScene(J)I+0".
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x15ed6e22, pid=8100, tid=2496
#
# JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
# Java VM: Java HotSpot(TM) Client VM (25.31-b07 mixed mode windows-x86 )
# Problematic frame:
# C [d3d9.dll+0x6e22]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x16580c00): JavaThread "Thread-4" daemon [_thread_in_native, id=2496, stack(0x1a4b0000,0x1a500000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x1fda8008
Registers:
EAX=0x0001366b, EBX=0x1fda8010, ECX=0x0145ee48, EDX=0x1a4ff14c
ESP=0x1a4ff194, EBP=0x1a4ff1dc, ESI=0x1fcddbb0, EDI=0x1a324a20
EIP=0x15ed6e22, EFLAGS=0x00210212
Top of Stack: (sp=0x1a4ff194)
0x1a4ff194: 1fda8000 00057000 ffff0000 15f90351
0x1a4ff1a4: 0001366b 01179ff0 000014d5 16580c00
0x1a4ff1b4: 1a4ff1dc 1fbb32a0 1fbb3178 1a27a2c8
0x1a4ff1c4: 00000008 16580c00 1e14f928 1e14f928
0x1a4ff1d4: 1e14f928 16580c00 1a4ff1e8 664a3413
0x1a4ff1e4: 1a324a20 1a4ff220 02afbe43 16580d38
0x1a4ff1f4: 1a4ff228 1e8825d0 00000000 1a4ff200
0x1a4ff204: 1e14f928 1a4ff234 1e150138 00000000
Instructions: (pc=0x15ed6e22)
0x15ed6e02: 8b 45 e4 8b 4f 0c 83 c3 0c 8b 40 24 c7 44 24 0c
0x15ed6e12: 51 03 f9 15 c7 44 24 08 00 00 ff ff 89 44 24 10
0x15ed6e22: d9 43 f8 d9 5c 24 04 d9 43 f4 d9 1c 24 e8 bc ba
0x15ed6e32: 01 00 83 ec 14 39 de 75 c7 8b 45 e4 8b 58 28 83
Register to memory mapping:
EAX=0x0001366b is an unknown value
EBX=0x1fda8010 is an unknown value
ECX=0x0145ee48 is an unknown value
EDX=0x1a4ff14c is pointing into the stack for thread: 0x16580c00
ESP=0x1a4ff194 is pointing into the stack for thread: 0x16580c00
EBP=0x1a4ff1dc is pointing into the stack for thread: 0x16580c00
ESI=0x1fcddbb0 is an unknown value
EDI=0x1a324a20 is an unknown value
Stack: [0x1a4b0000,0x1a500000], sp=0x1a4ff194, free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [d3d9.dll+0x6e22]
C [jagdx.dll+0x3413]
j jagdx.IDirect3DDevice.EndScene(J)I+0
j ank.c(II)V+46
J 1293 C1 db.d(B)V (31 bytes) @ 0x02f28004 [0x02f27fd0+0x34]
J 640 C1 client.ap(I)V (1366 bytes) @ 0x02cc8e6c [0x02cc7e30+0x103c]
J 639 C1 rk.w(I)V (293 bytes) @ 0x02cc6708 [0x02cc6460+0x2a8]
J 663% C1 rk.z(B)V (431 bytes) @ 0x02cdbea8 [0x02cdb9a0+0x508]
j rk.run()V+3
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
V [jvm.dll+0x1473e5]
V [jvm.dll+0x20d57e]
V [jvm.dll+0x14747e]
V [jvm.dll+0x147606]
V [jvm.dll+0x147677]
V [jvm.dll+0xf09df]
V [jvm.dll+0x169acc]
V [jvm.dll+0x16a35a]
V [jvm.dll+0x1af0a6]
C [msvcr100.dll+0x5c556]
C [msvcr100.dll+0x5c600]
C [KERNEL32.DLL+0x17c04]
C [ntdll.dll+0x5ad1f]
C [ntdll.dll+0x5acea]
C 0x00000000
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j jagdx.IDirect3DDevice.EndScene(J)I+0
j ank.c(II)V+46
J 1293 C1 db.d(B)V (31 bytes) @ 0x02f28004 [0x02f27fd0+0x34]
J 640 C1 client.ap(I)V (1366 bytes) @ 0x02cc8e6c [0x02cc7e30+0x103c]
J 639 C1 rk.w(I)V (293 bytes) @ 0x02cc6708 [0x02cc6460+0x2a8]
J 663% C1 rk.z(B)V (431 bytes) @ 0x02cdbea8 [0x02cdb9a0+0x508]
j rk.run()V+3
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x16871c00 JavaThread "Smart_Image_Transfer" daemon [_thread_blocked, id=6396, stack(0x19dc0000,0x19e10000)]
0x16872800 JavaThread "pool-1-thread-2" [_thread_blocked, id=7296, stack(0x19480000,0x194d0000)]
0x16876000 JavaThread "Thread-43" daemon [_thread_blocked, id=5432, stack(0x1be00000,0x1be50000)]
0x16872000 JavaThread "Thread-42" daemon [_thread_in_native, id=7148, stack(0x1bd70000,0x1bdc0000)]
0x16870800 JavaThread "Thread-14" daemon [_thread_in_native, id=1448, stack(0x192a0000,0x192f0000)]
0x16873000 JavaThread "Thread-13" daemon [_thread_blocked, id=308, stack(0x19170000,0x191c0000)]
0x16870400 JavaThread "Thread-12" daemon [_thread_blocked, id=3640, stack(0x190e0000,0x19130000)]
0x16873c00 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=5296, stack(0x18d80000,0x18dd0000)]
0x167dfc00 JavaThread "pool-1-thread-1" [_thread_blocked, id=1740, stack(0x1b750000,0x1b7a0000)]
0x167df400 JavaThread "Thread-8" daemon [_thread_blocked, id=6356, stack(0x1b630000,0x1b680000)]
0x167e1400 JavaThread "Thread-7" daemon [_thread_blocked, id=2948, stack(0x1b5a0000,0x1b5f0000)]
0x168dd800 JavaThread "Thread-6" daemon [_thread_blocked, id=5568, stack(0x1b410000,0x1b460000)]
0x16724c00 JavaThread "D3D Screen Updater" daemon [_thread_blocked, id=7968, stack(0x1b000000,0x1b050000)]
0x16666000 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=3012, stack(0x1a5d0000,0x1a620000)]
0x1a7ff400 JavaThread "AWT-Shutdown" [_thread_blocked, id=5720, stack(0x1a540000,0x1a590000)]
=>0x16580c00 JavaThread "Thread-4" daemon [_thread_in_native, id=2496, stack(0x1a4b0000,0x1a500000)]
0x1a9f0c00 JavaThread "Thread-3" daemon [_thread_blocked, id=7772, stack(0x1a220000,0x1a270000)]
0x1a9d0400 JavaThread "Thread-2" daemon [_thread_blocked, id=880, stack(0x1a190000,0x1a1e0000)]
0x1687c400 JavaThread "Thread-1" daemon [_thread_blocked, id=3700, stack(0x174b0000,0x17500000)]
0x1524f400 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5924, stack(0x17540000,0x17590000)]
0x1524d800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=6568, stack(0x17420000,0x17470000)]
0x150ad400 JavaThread "Service Thread" daemon [_thread_blocked, id=6708, stack(0x15530000,0x15580000)]
0x15085c00 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=6952, stack(0x154a0000,0x154f0000)]
0x15084c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=5104, stack(0x15410000,0x15460000)]
0x15082c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5896, stack(0x15380000,0x153d0000)]
0x15064800 JavaThread "Finalizer" daemon [_thread_blocked, id=5112, stack(0x152f0000,0x15340000)]
0x02aee800 JavaThread "Reference Handler" daemon [_thread_blocked, id=2532, stack(0x15260000,0x152b0000)]
0x0117c000 JavaThread "main" [_thread_in_native, id=2616, stack(0x00fa0000,0x00ff0000)]
Other Threads:
0x02aea400 VMThread [stack: 0x04b80000,0x04bd0000] [id=2600]
0x150b1000 WatcherThread [stack: 0x155c0000,0x15610000] [id=5224]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap:
def new generation total 78656K, used 27986K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 40% used [0x04c00000, 0x06754b90, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 168162K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 96% used [0x0a150000, 0x145888c0, 0x14588a00, 0x14c00000)
Metaspace used 19163K, capacity 19309K, committed 19456K, reserved 19840K
Card table byte_map: [0x04af0000,0x04b80000] byte_map_base: 0x04aca000
Polling page: 0x00ee0000
CodeCache: size=32768Kb used=11097Kb max_used=11184Kb free=21670Kb
bounds [0x02af0000, 0x035e0000, 0x04af0000]
total_blobs=2752 nmethods=2386 adapters=296
compilation: enabled
Compilation events (10 events):
Event: 174.514 Thread 0x15085c00 2734 ade::be (169 bytes)
Event: 174.515 Thread 0x15085c00 nmethod 2734 0x035dd908 code [0x035dda40, 0x035ddc8c]
Event: 174.540 Thread 0x15085c00 2735 java.util.Arrays::binarySearch0 (95 bytes)
Event: 174.540 Thread 0x15085c00 nmethod 2735 0x02c0e148 code [0x02c0e260, 0x02c0e3c8]
Event: 174.542 Thread 0x15085c00 2736 sun.java2d.loops.GraphicsPrimitive::getUniqueID (5 bytes)
Event: 174.542 Thread 0x15085c00 nmethod 2736 0x02c0df88 code [0x02c0e080, 0x02c0e100]
Event: 174.545 Thread 0x15085c00 2737 s sun.java2d.loops.GraphicsPrimitiveMgr::locatePrim (96 bytes)
Event: 174.546 Thread 0x15085c00 nmethod 2737 0x02bdd588 code [0x02bdd6c0, 0x02bddb6c]
Event: 174.546 Thread 0x15085c00 2738 sun.java2d.loops.GraphicsPrimitiveMgr$2::compare (39 bytes)
Event: 174.546 Thread 0x15085c00 nmethod 2738 0x02bdca48 code [0x02bdcb50, 0x02bdcc50]
GC Heap History (10 events):
Event: 173.173 GC heap before
{Heap before GC invocations=52 (full 16):
def new generation total 78656K, used 69952K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 100% used [0x04c00000, 0x09050000, 0x09050000)
from space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 146089K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 83% used [0x0a150000, 0x12ffa598, 0x12ffa600, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
Event: 173.263 GC heap after
Heap after GC invocations=53 (full 17):
def new generation total 78656K, used 0K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 124578K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 71% used [0x0a150000, 0x11af8980, 0x11af8a00, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
}
Event: 173.477 GC heap before
{Heap before GC invocations=53 (full 17):
def new generation total 78656K, used 69952K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 100% used [0x04c00000, 0x09050000, 0x09050000)
from space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 124578K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 71% used [0x0a150000, 0x11af8980, 0x11af8a00, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
Event: 173.492 GC heap after
Heap after GC invocations=54 (full 17):
def new generation total 78656K, used 8703K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 99% used [0x09050000, 0x098cfff8, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 140524K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 80% used [0x0a150000, 0x12a8b058, 0x12a8b200, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
}
Event: 173.877 GC heap before
{Heap before GC invocations=54 (full 17):
def new generation total 78656K, used 78655K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 100% used [0x04c00000, 0x09050000, 0x09050000)
from space 8704K, 99% used [0x09050000, 0x098cfff8, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 140524K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 80% used [0x0a150000, 0x12a8b070, 0x12a8b200, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
Event: 173.896 GC heap after
Heap after GC invocations=55 (full 17):
def new generation total 78656K, used 8703K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 99% used [0x098d0000, 0x0a14fff8, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 158619K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 90% used [0x0a150000, 0x13c36e48, 0x13c37000, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
}
Event: 173.897 GC heap before
{Heap before GC invocations=55 (full 17):
def new generation total 78656K, used 8706K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00830, 0x09050000)
from space 8704K, 99% used [0x098d0000, 0x0a14fff8, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 158619K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 90% used [0x0a150000, 0x13c36e48, 0x13c37000, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
Event: 173.905 GC heap after
Heap after GC invocations=56 (full 17):
def new generation total 78656K, used 0K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 167323K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 95% used [0x0a150000, 0x144b6e40, 0x144b7000, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
}
Event: 174.395 GC heap before
{Heap before GC invocations=56 (full 17):
def new generation total 78656K, used 69755K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 99% used [0x04c00000, 0x0901ed58, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 167323K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 95% used [0x0a150000, 0x144b6e40, 0x144b7000, 0x14c00000)
Metaspace used 19163K, capacity 19309K, committed 19456K, reserved 19840K
Event: 174.507 GC heap after
Heap after GC invocations=57 (full 18):
def new generation total 78656K, used 23281K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 33% used [0x04c00000, 0x062bc580, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 168162K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 96% used [0x0a150000, 0x145888c0, 0x14588a00, 0x14c00000)
Metaspace used 19163K, capacity 19309K, committed 19456K, reserved 19840K
}
Deoptimization events (0 events):
No events
Internal exceptions (10 events):
Event: 173.114 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x071061a0) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.114 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07106850) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.558 Thread 0x16580c00 Implicit null exception at 0x02c00bd6 to 0x02c0125b
Event: 173.579 Thread 0x16580c00 Implicit null exception at 0x0353f04b to 0x0354032c
Event: 173.644 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07378810) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.645 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07378ec0) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.726 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07b84588) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.727 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07b84e20) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 174.326 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x08672c58) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 174.326 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x08673310) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Events (10 events):
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1ee08
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1f148
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1f448
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1f888
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1fc88
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c20088
Event: 174.539 Executing VM operation: BulkRevokeBias
Event: 174.539 Executing VM operation: BulkRevokeBias done
Event: 174.539 Executing VM operation: BulkRevokeBias
Event: 174.539 Executing VM operation: BulkRevokeBias done
Dynamic libraries:
0x01060000 - 0x01090000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\java.exe
0x77cc0000 - 0x77e2e000 C:\WINDOWS\SYSTEM32\ntdll.dll
0x772e0000 - 0x77420000 C:\WINDOWS\SYSTEM32\KERNEL32.DLL
0x77aa0000 - 0x77b77000 C:\WINDOWS\SYSTEM32\KERNELBASE.dll
0x74770000 - 0x74810000 C:\WINDOWS\system32\apphelp.dll
0x601d0000 - 0x60436000 C:\WINDOWS\AppPatch\AcGenral.DLL
0x76c10000 - 0x76cd3000 C:\WINDOWS\SYSTEM32\msvcrt.dll
0x77b80000 - 0x77bc1000 C:\WINDOWS\SYSTEM32\sechost.dll
0x754c0000 - 0x754de000 C:\WINDOWS\SYSTEM32\SspiCli.dll
0x76f70000 - 0x76fb5000 C:\WINDOWS\SYSTEM32\SHLWAPI.dll
0x72140000 - 0x7222d000 C:\WINDOWS\SYSTEM32\UxTheme.dll
0x77940000 - 0x77a93000 C:\WINDOWS\SYSTEM32\USER32.dll
0x76d80000 - 0x76e8e000 C:\WINDOWS\SYSTEM32\GDI32.dll
0x71ce0000 - 0x71d03000 C:\WINDOWS\SYSTEM32\WINMM.dll
0x72280000 - 0x72293000 C:\WINDOWS\SYSTEM32\samcli.dll
0x771b0000 - 0x772d8000 C:\WINDOWS\SYSTEM32\ole32.dll
0x76ce0000 - 0x76d75000 C:\WINDOWS\SYSTEM32\OLEAUT32.dll
0x6cd50000 - 0x6cd67000 C:\WINDOWS\SYSTEM32\MSACM32.dll
0x75440000 - 0x75448000 C:\WINDOWS\SYSTEM32\VERSION.dll
0x757e0000 - 0x76a8c000 C:\WINDOWS\SYSTEM32\SHELL32.dll
0x74860000 - 0x7487b000 C:\WINDOWS\SYSTEM32\USERENV.dll
0x72120000 - 0x7213a000 C:\WINDOWS\SYSTEM32\dwmapi.dll
0x6f500000 - 0x6f64a000 C:\WINDOWS\SYSTEM32\urlmon.dll
0x778c0000 - 0x7793c000 C:\WINDOWS\SYSTEM32\ADVAPI32.dll
0x753d0000 - 0x75435000 C:\WINDOWS\SYSTEM32\WINSPOOL.DRV
0x71440000 - 0x71456000 C:\WINDOWS\SYSTEM32\MPR.dll
0x775e0000 - 0x7769a000 C:\WINDOWS\SYSTEM32\RPCRT4.dll
0x754b0000 - 0x754ba000 C:\WINDOWS\SYSTEM32\CRYPTBASE.dll
0x76a90000 - 0x76c0d000 C:\WINDOWS\SYSTEM32\combase.dll
0x71cb0000 - 0x71cd3000 C:\WINDOWS\SYSTEM32\WINMMBASE.dll
0x74810000 - 0x7481f000 C:\WINDOWS\SYSTEM32\profapi.dll
0x74880000 - 0x74ab2000 C:\WINDOWS\SYSTEM32\iertutil.dll
0x74ca0000 - 0x74e73000 C:\WINDOWS\SYSTEM32\WININET.dll
0x75450000 - 0x754a4000 C:\WINDOWS\SYSTEM32\bcryptPrimitives.dll
0x76f20000 - 0x76f5c000 C:\WINDOWS\SYSTEM32\cfgmgr32.dll
0x753a0000 - 0x753c1000 C:\WINDOWS\SYSTEM32\DEVOBJ.dll
0x735a0000 - 0x7362b000 C:\WINDOWS\SYSTEM32\SHCORE.DLL
0x77180000 - 0x771a7000 C:\WINDOWS\system32\IMM32.DLL
0x75600000 - 0x75712000 C:\WINDOWS\SYSTEM32\MSCTF.dll
0x70940000 - 0x70b46000 C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17784_none_a9f4 97a901334c74\COMCTL32.dll
0x6a310000 - 0x6a3cf000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\msvcr100.dll
0x5dd90000 - 0x5e134000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\client\jvm.dll
0x74f30000 - 0x74f38000 C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x75720000 - 0x75726000 C:\WINDOWS\SYSTEM32\PSAPI.DLL
0x75540000 - 0x75590000 C:\WINDOWS\SYSTEM32\WS2_32.dll
0x77420000 - 0x77427000 C:\WINDOWS\SYSTEM32\NSI.dll
0x6cd70000 - 0x6cd7c000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\verify.dll
0x69840000 - 0x69861000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\java.dll
0x69e50000 - 0x69e63000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\zip.dll
0x6e600000 - 0x6e691000 C:\Simba\Plugins\libsmartjni32.dll
0x69820000 - 0x69835000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\net.dll
0x73160000 - 0x731ab000 C:\WINDOWS\system32\mswsock.dll
0x6c550000 - 0x6c55f000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\nio.dll
0x68540000 - 0x6861d000 C:\Simba\Plugins\OpenGL32.dll
0x70b70000 - 0x70b95000 C:\WINDOWS\SYSTEM32\GLU32.DLL
0x70260000 - 0x7033e000 C:\WINDOWS\system32\opengl32.dll
0x6c200000 - 0x6c2ec000 C:\WINDOWS\SYSTEM32\DDRAW.dll
0x72110000 - 0x72117000 C:\WINDOWS\SYSTEM32\DCIMAN32.dll
0x15ed0000 - 0x15fa8000 C:\Simba\Plugins\d3d9.dll
0x5ff30000 - 0x6012f000 C:\WINDOWS\SYSTEM32\d3dx9_43.dll
0x6d9b0000 - 0x6db83000 C:\WINDOWS\system32\d3d9.dll
0x74ac0000 - 0x74b3e000 C:\WINDOWS\SYSTEM32\DNSAPI.dll
0x73130000 - 0x73151000 C:\Program Files (x86)\Bonjour\mdnsNSP.dll
0x74c80000 - 0x74ca0000 C:\WINDOWS\SYSTEM32\Iphlpapi.DLL
0x74850000 - 0x74858000 C:\WINDOWS\SYSTEM32\WINNSI.DLL
0x73120000 - 0x73128000 C:\Windows\System32\rasadhlp.dll
0x72ac0000 - 0x72b06000 C:\WINDOWS\System32\fwpuclnt.dll
0x61160000 - 0x612a6000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\awt.dll
0x74490000 - 0x744a9000 C:\WINDOWS\SYSTEM32\CRYPTSP.dll
0x74460000 - 0x74490000 C:\WINDOWS\system32\rsaenh.dll
0x74440000 - 0x7445e000 C:\WINDOWS\SYSTEM32\bcrypt.dll
0x73700000 - 0x73713000 C:\WINDOWS\SYSTEM32\dhcpcsvc6.DLL
0x736e0000 - 0x736f4000 C:\WINDOWS\SYSTEM32\dhcpcsvc.DLL
0x73e40000 - 0x73e49000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll
0x664c0000 - 0x67231000 C:\WINDOWS\SYSTEM32\nvd3dum.dll
0x17590000 - 0x176ca000 C:\WINDOWS\system32\nvspcap.dll
0x73cb0000 - 0x73cf0000 C:\WINDOWS\system32\powrprof.dll
0x6d480000 - 0x6d5ba000 C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPI.dll
0x76fc0000 - 0x77171000 C:\WINDOWS\SYSTEM32\SETUPAPI.dll
0x69800000 - 0x69820000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\sunec.dll
0x72bd0000 - 0x72be1000 C:\WINDOWS\system32\napinsp.dll
0x72bb0000 - 0x72bc6000 C:\WINDOWS\system32\pnrpnsp.dll
0x72c60000 - 0x72c74000 C:\WINDOWS\system32\NLAapi.dll
0x72b10000 - 0x72b1a000 C:\WINDOWS\System32\winrnr.dll
0x72ab0000 - 0x72ac0000 C:\WINDOWS\system32\wshbth.dll
0x697e0000 - 0x697f2000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\unpack.dll
0x697a0000 - 0x697d9000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\fontmanager.dll
0x69770000 - 0x697a0000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\t2k.dll
0x69620000 - 0x69645000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jpeg.dll
0x6b880000 - 0x6b88a000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jsound.dll
0x6b560000 - 0x6b569000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jsoundds.dll
0x6ceb0000 - 0x6cf31000 C:\WINDOWS\SYSTEM32\DSOUND.dll
0x6cf70000 - 0x6cfc3000 C:\WINDOWS\SYSTEM32\MMDevAPI.DLL
0x70800000 - 0x70836000 C:\WINDOWS\SYSTEM32\wdmaud.drv
0x6f930000 - 0x6f937000 C:\WINDOWS\SYSTEM32\ksuser.dll
0x6f920000 - 0x6f92a000 C:\WINDOWS\SYSTEM32\AVRT.dll
0x6cd80000 - 0x6cde0000 C:\WINDOWS\SYSTEM32\AUDIOSES.DLL
0x71ff0000 - 0x71ff9000 C:\WINDOWS\SYSTEM32\msacm32.drv
0x70f80000 - 0x70f88000 C:\WINDOWS\SYSTEM32\midimap.dll
0x76e90000 - 0x76f1d000 C:\WINDOWS\SYSTEM32\clbcatq.dll
0x68f20000 - 0x68f46000 C:\Users\Ned\jagexcache\runescape\LIVE\jaclib.dll
0x6a300000 - 0x6a306000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jawt.dll
0x72090000 - 0x7209d000 C:\WINDOWS\system32\wbem\wbemprox.dll
0x720a0000 - 0x72106000 C:\WINDOWS\SYSTEM32\wbemcomn.dll
0x71ad0000 - 0x71ae1000 C:\WINDOWS\system32\wbem\wbemsvc.dll
0x71a00000 - 0x71ac4000 C:\WINDOWS\system32\wbem\fastprox.dll
0x69760000 - 0x6976c000 C:\WINDOWS\system32\winbrand.dll
0x77430000 - 0x7746d000 C:\WINDOWS\SYSTEM32\WINTRUST.dll
0x77730000 - 0x778b8000 C:\WINDOWS\SYSTEM32\CRYPT32.dll
0x75590000 - 0x7559e000 C:\WINDOWS\SYSTEM32\MSASN1.dll
0x68f50000 - 0x69239000 C:\WINDOWS\system32\nvapi.dll
0x69600000 - 0x6961a000 C:\Users\Ned\jagexcache\runescape\LIVE\jaggl.dll
0x54a90000 - 0x56258000 C:\WINDOWS\SYSTEM32\nvoglv32.DLL
0x73100000 - 0x7310f000 C:\WINDOWS\SYSTEM32\WTSAPI32.dll
0x75370000 - 0x75398000 C:\WINDOWS\SYSTEM32\ntmarta.dll
0x730b0000 - 0x730f5000 C:\WINDOWS\SYSTEM32\WINSTA.dll
0x68eb0000 - 0x68eba000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\management.dll
0x664a0000 - 0x664b6000 C:\Users\Ned\jagexcache\runescape\LIVE\jagdx.dll
0x701d0000 - 0x701e6000 C:\WINDOWS\SYSTEM32\usp10.dll
0x6b730000 - 0x6b871000 C:\WINDOWS\SYSTEM32\dbghelp.dll
VM Arguments:
jvm_args: -Xbootclasspath/p:C:/Simba/Plugins//smart.jar
java_command: smart.Main C:/Simba/Plugins//libsmartjni32.dll http://world9.runescape.com/ ,f7649838988217813349 800 600 C:/Simba/Plugins/ OpenGL32.dll,d3d9.dll
java_class_path (initial): .;C:\Program Files (x86)\Java\jre1.8.0_31\lib\ext\QTJava.zip
Launcher Type: SUN_STANDARD
Environment Variables:
CLASSPATH=.;C:\Program Files (x86)\Java\jre1.8.0_31\lib\ext\QTJava.zip
PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Jav a\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDO WS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerS hell\v1.0\;C:\Program Files (x86)\Common Files\Avid;C:\Program Files\Common Files\Avid;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmd
USERNAME=Ned
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 8.1 , 64 bit Build 9600
CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, erms, ht, tsc, tscinvbit, tscinv
Memory: 4k page, physical 16681672k(13258348k free), swap 19172040k(14948508k free)
vm_info: Java HotSpot(TM) Client VM (25.31-b07) for windows-x86 JRE (1.8.0_31-b13), built on Dec 17 2014 20:46:12 by "java_re" with MS VC++ 10.0 (VS2010)
time: Sun May 24 00:24:54 2015
elapsed time: 178 seconds (0d 0h 2m 58s)
Brandon
05-24-2015, 04:45 AM
Could this be the log you are looking for?
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x15ed6e22, pid=8100, tid=2496
#
# JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
# Java VM: Java HotSpot(TM) Client VM (25.31-b07 mixed mode windows-x86 )
# Problematic frame:
# C [d3d9.dll+0x6e22]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x16580c00): JavaThread "Thread-4" daemon [_thread_in_native, id=2496, stack(0x1a4b0000,0x1a500000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x1fda8008
Registers:
EAX=0x0001366b, EBX=0x1fda8010, ECX=0x0145ee48, EDX=0x1a4ff14c
ESP=0x1a4ff194, EBP=0x1a4ff1dc, ESI=0x1fcddbb0, EDI=0x1a324a20
EIP=0x15ed6e22, EFLAGS=0x00210212
Top of Stack: (sp=0x1a4ff194)
0x1a4ff194: 1fda8000 00057000 ffff0000 15f90351
0x1a4ff1a4: 0001366b 01179ff0 000014d5 16580c00
0x1a4ff1b4: 1a4ff1dc 1fbb32a0 1fbb3178 1a27a2c8
0x1a4ff1c4: 00000008 16580c00 1e14f928 1e14f928
0x1a4ff1d4: 1e14f928 16580c00 1a4ff1e8 664a3413
0x1a4ff1e4: 1a324a20 1a4ff220 02afbe43 16580d38
0x1a4ff1f4: 1a4ff228 1e8825d0 00000000 1a4ff200
0x1a4ff204: 1e14f928 1a4ff234 1e150138 00000000
Instructions: (pc=0x15ed6e22)
0x15ed6e02: 8b 45 e4 8b 4f 0c 83 c3 0c 8b 40 24 c7 44 24 0c
0x15ed6e12: 51 03 f9 15 c7 44 24 08 00 00 ff ff 89 44 24 10
0x15ed6e22: d9 43 f8 d9 5c 24 04 d9 43 f4 d9 1c 24 e8 bc ba
0x15ed6e32: 01 00 83 ec 14 39 de 75 c7 8b 45 e4 8b 58 28 83
Register to memory mapping:
EAX=0x0001366b is an unknown value
EBX=0x1fda8010 is an unknown value
ECX=0x0145ee48 is an unknown value
EDX=0x1a4ff14c is pointing into the stack for thread: 0x16580c00
ESP=0x1a4ff194 is pointing into the stack for thread: 0x16580c00
EBP=0x1a4ff1dc is pointing into the stack for thread: 0x16580c00
ESI=0x1fcddbb0 is an unknown value
EDI=0x1a324a20 is an unknown value
Stack: [0x1a4b0000,0x1a500000], sp=0x1a4ff194, free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [d3d9.dll+0x6e22]
C [jagdx.dll+0x3413]
j jagdx.IDirect3DDevice.EndScene(J)I+0
j ank.c(II)V+46
J 1293 C1 db.d(B)V (31 bytes) @ 0x02f28004 [0x02f27fd0+0x34]
J 640 C1 client.ap(I)V (1366 bytes) @ 0x02cc8e6c [0x02cc7e30+0x103c]
J 639 C1 rk.w(I)V (293 bytes) @ 0x02cc6708 [0x02cc6460+0x2a8]
J 663% C1 rk.z(B)V (431 bytes) @ 0x02cdbea8 [0x02cdb9a0+0x508]
j rk.run()V+3
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
V [jvm.dll+0x1473e5]
V [jvm.dll+0x20d57e]
V [jvm.dll+0x14747e]
V [jvm.dll+0x147606]
V [jvm.dll+0x147677]
V [jvm.dll+0xf09df]
V [jvm.dll+0x169acc]
V [jvm.dll+0x16a35a]
V [jvm.dll+0x1af0a6]
C [msvcr100.dll+0x5c556]
C [msvcr100.dll+0x5c600]
C [KERNEL32.DLL+0x17c04]
C [ntdll.dll+0x5ad1f]
C [ntdll.dll+0x5acea]
C 0x00000000
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j jagdx.IDirect3DDevice.EndScene(J)I+0
j ank.c(II)V+46
J 1293 C1 db.d(B)V (31 bytes) @ 0x02f28004 [0x02f27fd0+0x34]
J 640 C1 client.ap(I)V (1366 bytes) @ 0x02cc8e6c [0x02cc7e30+0x103c]
J 639 C1 rk.w(I)V (293 bytes) @ 0x02cc6708 [0x02cc6460+0x2a8]
J 663% C1 rk.z(B)V (431 bytes) @ 0x02cdbea8 [0x02cdb9a0+0x508]
j rk.run()V+3
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x16871c00 JavaThread "Smart_Image_Transfer" daemon [_thread_blocked, id=6396, stack(0x19dc0000,0x19e10000)]
0x16872800 JavaThread "pool-1-thread-2" [_thread_blocked, id=7296, stack(0x19480000,0x194d0000)]
0x16876000 JavaThread "Thread-43" daemon [_thread_blocked, id=5432, stack(0x1be00000,0x1be50000)]
0x16872000 JavaThread "Thread-42" daemon [_thread_in_native, id=7148, stack(0x1bd70000,0x1bdc0000)]
0x16870800 JavaThread "Thread-14" daemon [_thread_in_native, id=1448, stack(0x192a0000,0x192f0000)]
0x16873000 JavaThread "Thread-13" daemon [_thread_blocked, id=308, stack(0x19170000,0x191c0000)]
0x16870400 JavaThread "Thread-12" daemon [_thread_blocked, id=3640, stack(0x190e0000,0x19130000)]
0x16873c00 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=5296, stack(0x18d80000,0x18dd0000)]
0x167dfc00 JavaThread "pool-1-thread-1" [_thread_blocked, id=1740, stack(0x1b750000,0x1b7a0000)]
0x167df400 JavaThread "Thread-8" daemon [_thread_blocked, id=6356, stack(0x1b630000,0x1b680000)]
0x167e1400 JavaThread "Thread-7" daemon [_thread_blocked, id=2948, stack(0x1b5a0000,0x1b5f0000)]
0x168dd800 JavaThread "Thread-6" daemon [_thread_blocked, id=5568, stack(0x1b410000,0x1b460000)]
0x16724c00 JavaThread "D3D Screen Updater" daemon [_thread_blocked, id=7968, stack(0x1b000000,0x1b050000)]
0x16666000 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=3012, stack(0x1a5d0000,0x1a620000)]
0x1a7ff400 JavaThread "AWT-Shutdown" [_thread_blocked, id=5720, stack(0x1a540000,0x1a590000)]
=>0x16580c00 JavaThread "Thread-4" daemon [_thread_in_native, id=2496, stack(0x1a4b0000,0x1a500000)]
0x1a9f0c00 JavaThread "Thread-3" daemon [_thread_blocked, id=7772, stack(0x1a220000,0x1a270000)]
0x1a9d0400 JavaThread "Thread-2" daemon [_thread_blocked, id=880, stack(0x1a190000,0x1a1e0000)]
0x1687c400 JavaThread "Thread-1" daemon [_thread_blocked, id=3700, stack(0x174b0000,0x17500000)]
0x1524f400 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5924, stack(0x17540000,0x17590000)]
0x1524d800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=6568, stack(0x17420000,0x17470000)]
0x150ad400 JavaThread "Service Thread" daemon [_thread_blocked, id=6708, stack(0x15530000,0x15580000)]
0x15085c00 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=6952, stack(0x154a0000,0x154f0000)]
0x15084c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=5104, stack(0x15410000,0x15460000)]
0x15082c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5896, stack(0x15380000,0x153d0000)]
0x15064800 JavaThread "Finalizer" daemon [_thread_blocked, id=5112, stack(0x152f0000,0x15340000)]
0x02aee800 JavaThread "Reference Handler" daemon [_thread_blocked, id=2532, stack(0x15260000,0x152b0000)]
0x0117c000 JavaThread "main" [_thread_in_native, id=2616, stack(0x00fa0000,0x00ff0000)]
Other Threads:
0x02aea400 VMThread [stack: 0x04b80000,0x04bd0000] [id=2600]
0x150b1000 WatcherThread [stack: 0x155c0000,0x15610000] [id=5224]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap:
def new generation total 78656K, used 27986K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 40% used [0x04c00000, 0x06754b90, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 168162K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 96% used [0x0a150000, 0x145888c0, 0x14588a00, 0x14c00000)
Metaspace used 19163K, capacity 19309K, committed 19456K, reserved 19840K
Card table byte_map: [0x04af0000,0x04b80000] byte_map_base: 0x04aca000
Polling page: 0x00ee0000
CodeCache: size=32768Kb used=11097Kb max_used=11184Kb free=21670Kb
bounds [0x02af0000, 0x035e0000, 0x04af0000]
total_blobs=2752 nmethods=2386 adapters=296
compilation: enabled
Compilation events (10 events):
Event: 174.514 Thread 0x15085c00 2734 ade::be (169 bytes)
Event: 174.515 Thread 0x15085c00 nmethod 2734 0x035dd908 code [0x035dda40, 0x035ddc8c]
Event: 174.540 Thread 0x15085c00 2735 java.util.Arrays::binarySearch0 (95 bytes)
Event: 174.540 Thread 0x15085c00 nmethod 2735 0x02c0e148 code [0x02c0e260, 0x02c0e3c8]
Event: 174.542 Thread 0x15085c00 2736 sun.java2d.loops.GraphicsPrimitive::getUniqueID (5 bytes)
Event: 174.542 Thread 0x15085c00 nmethod 2736 0x02c0df88 code [0x02c0e080, 0x02c0e100]
Event: 174.545 Thread 0x15085c00 2737 s sun.java2d.loops.GraphicsPrimitiveMgr::locatePrim (96 bytes)
Event: 174.546 Thread 0x15085c00 nmethod 2737 0x02bdd588 code [0x02bdd6c0, 0x02bddb6c]
Event: 174.546 Thread 0x15085c00 2738 sun.java2d.loops.GraphicsPrimitiveMgr$2::compare (39 bytes)
Event: 174.546 Thread 0x15085c00 nmethod 2738 0x02bdca48 code [0x02bdcb50, 0x02bdcc50]
GC Heap History (10 events):
Event: 173.173 GC heap before
{Heap before GC invocations=52 (full 16):
def new generation total 78656K, used 69952K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 100% used [0x04c00000, 0x09050000, 0x09050000)
from space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 146089K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 83% used [0x0a150000, 0x12ffa598, 0x12ffa600, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
Event: 173.263 GC heap after
Heap after GC invocations=53 (full 17):
def new generation total 78656K, used 0K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 124578K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 71% used [0x0a150000, 0x11af8980, 0x11af8a00, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
}
Event: 173.477 GC heap before
{Heap before GC invocations=53 (full 17):
def new generation total 78656K, used 69952K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 100% used [0x04c00000, 0x09050000, 0x09050000)
from space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 124578K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 71% used [0x0a150000, 0x11af8980, 0x11af8a00, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
Event: 173.492 GC heap after
Heap after GC invocations=54 (full 17):
def new generation total 78656K, used 8703K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 99% used [0x09050000, 0x098cfff8, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 140524K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 80% used [0x0a150000, 0x12a8b058, 0x12a8b200, 0x14c00000)
Metaspace used 19069K, capacity 19213K, committed 19328K, reserved 19840K
}
Event: 173.877 GC heap before
{Heap before GC invocations=54 (full 17):
def new generation total 78656K, used 78655K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 100% used [0x04c00000, 0x09050000, 0x09050000)
from space 8704K, 99% used [0x09050000, 0x098cfff8, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 140524K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 80% used [0x0a150000, 0x12a8b070, 0x12a8b200, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
Event: 173.896 GC heap after
Heap after GC invocations=55 (full 17):
def new generation total 78656K, used 8703K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 99% used [0x098d0000, 0x0a14fff8, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 158619K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 90% used [0x0a150000, 0x13c36e48, 0x13c37000, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
}
Event: 173.897 GC heap before
{Heap before GC invocations=55 (full 17):
def new generation total 78656K, used 8706K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00830, 0x09050000)
from space 8704K, 99% used [0x098d0000, 0x0a14fff8, 0x0a150000)
to space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
tenured generation total 174784K, used 158619K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 90% used [0x0a150000, 0x13c36e48, 0x13c37000, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
Event: 173.905 GC heap after
Heap after GC invocations=56 (full 17):
def new generation total 78656K, used 0K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 0% used [0x04c00000, 0x04c00000, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 167323K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 95% used [0x0a150000, 0x144b6e40, 0x144b7000, 0x14c00000)
Metaspace used 19086K, capacity 19245K, committed 19328K, reserved 19840K
}
Event: 174.395 GC heap before
{Heap before GC invocations=56 (full 17):
def new generation total 78656K, used 69755K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 99% used [0x04c00000, 0x0901ed58, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 167323K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 95% used [0x0a150000, 0x144b6e40, 0x144b7000, 0x14c00000)
Metaspace used 19163K, capacity 19309K, committed 19456K, reserved 19840K
Event: 174.507 GC heap after
Heap after GC invocations=57 (full 18):
def new generation total 78656K, used 23281K [0x04c00000, 0x0a150000, 0x0a150000)
eden space 69952K, 33% used [0x04c00000, 0x062bc580, 0x09050000)
from space 8704K, 0% used [0x09050000, 0x09050000, 0x098d0000)
to space 8704K, 0% used [0x098d0000, 0x098d0000, 0x0a150000)
tenured generation total 174784K, used 168162K [0x0a150000, 0x14c00000, 0x14c00000)
the space 174784K, 96% used [0x0a150000, 0x145888c0, 0x14588a00, 0x14c00000)
Metaspace used 19163K, capacity 19309K, committed 19456K, reserved 19840K
}
Deoptimization events (0 events):
No events
Internal exceptions (10 events):
Event: 173.114 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x071061a0) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.114 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07106850) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.558 Thread 0x16580c00 Implicit null exception at 0x02c00bd6 to 0x02c0125b
Event: 173.579 Thread 0x16580c00 Implicit null exception at 0x0353f04b to 0x0354032c
Event: 173.644 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07378810) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.645 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07378ec0) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.726 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07b84588) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 173.727 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x07b84e20) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 174.326 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x08672c58) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Event: 174.326 Thread 0x16580c00 Exception <a 'java/security/PrivilegedActionException'> (0x08673310) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u31\2394\hotspot\src\share\vm\prims\jvm .cpp, line 1312]
Events (10 events):
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1ee08
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1f148
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1f448
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1f888
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c1fc88
Event: 174.515 Thread 0x15085c00 flushing nmethod 0x02c20088
Event: 174.539 Executing VM operation: BulkRevokeBias
Event: 174.539 Executing VM operation: BulkRevokeBias done
Event: 174.539 Executing VM operation: BulkRevokeBias
Event: 174.539 Executing VM operation: BulkRevokeBias done
Dynamic libraries:
0x01060000 - 0x01090000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\java.exe
0x77cc0000 - 0x77e2e000 C:\WINDOWS\SYSTEM32\ntdll.dll
0x772e0000 - 0x77420000 C:\WINDOWS\SYSTEM32\KERNEL32.DLL
0x77aa0000 - 0x77b77000 C:\WINDOWS\SYSTEM32\KERNELBASE.dll
0x74770000 - 0x74810000 C:\WINDOWS\system32\apphelp.dll
0x601d0000 - 0x60436000 C:\WINDOWS\AppPatch\AcGenral.DLL
0x76c10000 - 0x76cd3000 C:\WINDOWS\SYSTEM32\msvcrt.dll
0x77b80000 - 0x77bc1000 C:\WINDOWS\SYSTEM32\sechost.dll
0x754c0000 - 0x754de000 C:\WINDOWS\SYSTEM32\SspiCli.dll
0x76f70000 - 0x76fb5000 C:\WINDOWS\SYSTEM32\SHLWAPI.dll
0x72140000 - 0x7222d000 C:\WINDOWS\SYSTEM32\UxTheme.dll
0x77940000 - 0x77a93000 C:\WINDOWS\SYSTEM32\USER32.dll
0x76d80000 - 0x76e8e000 C:\WINDOWS\SYSTEM32\GDI32.dll
0x71ce0000 - 0x71d03000 C:\WINDOWS\SYSTEM32\WINMM.dll
0x72280000 - 0x72293000 C:\WINDOWS\SYSTEM32\samcli.dll
0x771b0000 - 0x772d8000 C:\WINDOWS\SYSTEM32\ole32.dll
0x76ce0000 - 0x76d75000 C:\WINDOWS\SYSTEM32\OLEAUT32.dll
0x6cd50000 - 0x6cd67000 C:\WINDOWS\SYSTEM32\MSACM32.dll
0x75440000 - 0x75448000 C:\WINDOWS\SYSTEM32\VERSION.dll
0x757e0000 - 0x76a8c000 C:\WINDOWS\SYSTEM32\SHELL32.dll
0x74860000 - 0x7487b000 C:\WINDOWS\SYSTEM32\USERENV.dll
0x72120000 - 0x7213a000 C:\WINDOWS\SYSTEM32\dwmapi.dll
0x6f500000 - 0x6f64a000 C:\WINDOWS\SYSTEM32\urlmon.dll
0x778c0000 - 0x7793c000 C:\WINDOWS\SYSTEM32\ADVAPI32.dll
0x753d0000 - 0x75435000 C:\WINDOWS\SYSTEM32\WINSPOOL.DRV
0x71440000 - 0x71456000 C:\WINDOWS\SYSTEM32\MPR.dll
0x775e0000 - 0x7769a000 C:\WINDOWS\SYSTEM32\RPCRT4.dll
0x754b0000 - 0x754ba000 C:\WINDOWS\SYSTEM32\CRYPTBASE.dll
0x76a90000 - 0x76c0d000 C:\WINDOWS\SYSTEM32\combase.dll
0x71cb0000 - 0x71cd3000 C:\WINDOWS\SYSTEM32\WINMMBASE.dll
0x74810000 - 0x7481f000 C:\WINDOWS\SYSTEM32\profapi.dll
0x74880000 - 0x74ab2000 C:\WINDOWS\SYSTEM32\iertutil.dll
0x74ca0000 - 0x74e73000 C:\WINDOWS\SYSTEM32\WININET.dll
0x75450000 - 0x754a4000 C:\WINDOWS\SYSTEM32\bcryptPrimitives.dll
0x76f20000 - 0x76f5c000 C:\WINDOWS\SYSTEM32\cfgmgr32.dll
0x753a0000 - 0x753c1000 C:\WINDOWS\SYSTEM32\DEVOBJ.dll
0x735a0000 - 0x7362b000 C:\WINDOWS\SYSTEM32\SHCORE.DLL
0x77180000 - 0x771a7000 C:\WINDOWS\system32\IMM32.DLL
0x75600000 - 0x75712000 C:\WINDOWS\SYSTEM32\MSCTF.dll
0x70940000 - 0x70b46000 C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17784_none_a9f4 97a901334c74\COMCTL32.dll
0x6a310000 - 0x6a3cf000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\msvcr100.dll
0x5dd90000 - 0x5e134000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\client\jvm.dll
0x74f30000 - 0x74f38000 C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x75720000 - 0x75726000 C:\WINDOWS\SYSTEM32\PSAPI.DLL
0x75540000 - 0x75590000 C:\WINDOWS\SYSTEM32\WS2_32.dll
0x77420000 - 0x77427000 C:\WINDOWS\SYSTEM32\NSI.dll
0x6cd70000 - 0x6cd7c000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\verify.dll
0x69840000 - 0x69861000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\java.dll
0x69e50000 - 0x69e63000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\zip.dll
0x6e600000 - 0x6e691000 C:\Simba\Plugins\libsmartjni32.dll
0x69820000 - 0x69835000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\net.dll
0x73160000 - 0x731ab000 C:\WINDOWS\system32\mswsock.dll
0x6c550000 - 0x6c55f000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\nio.dll
0x68540000 - 0x6861d000 C:\Simba\Plugins\OpenGL32.dll
0x70b70000 - 0x70b95000 C:\WINDOWS\SYSTEM32\GLU32.DLL
0x70260000 - 0x7033e000 C:\WINDOWS\system32\opengl32.dll
0x6c200000 - 0x6c2ec000 C:\WINDOWS\SYSTEM32\DDRAW.dll
0x72110000 - 0x72117000 C:\WINDOWS\SYSTEM32\DCIMAN32.dll
0x15ed0000 - 0x15fa8000 C:\Simba\Plugins\d3d9.dll
0x5ff30000 - 0x6012f000 C:\WINDOWS\SYSTEM32\d3dx9_43.dll
0x6d9b0000 - 0x6db83000 C:\WINDOWS\system32\d3d9.dll
0x74ac0000 - 0x74b3e000 C:\WINDOWS\SYSTEM32\DNSAPI.dll
0x73130000 - 0x73151000 C:\Program Files (x86)\Bonjour\mdnsNSP.dll
0x74c80000 - 0x74ca0000 C:\WINDOWS\SYSTEM32\Iphlpapi.DLL
0x74850000 - 0x74858000 C:\WINDOWS\SYSTEM32\WINNSI.DLL
0x73120000 - 0x73128000 C:\Windows\System32\rasadhlp.dll
0x72ac0000 - 0x72b06000 C:\WINDOWS\System32\fwpuclnt.dll
0x61160000 - 0x612a6000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\awt.dll
0x74490000 - 0x744a9000 C:\WINDOWS\SYSTEM32\CRYPTSP.dll
0x74460000 - 0x74490000 C:\WINDOWS\system32\rsaenh.dll
0x74440000 - 0x7445e000 C:\WINDOWS\SYSTEM32\bcrypt.dll
0x73700000 - 0x73713000 C:\WINDOWS\SYSTEM32\dhcpcsvc6.DLL
0x736e0000 - 0x736f4000 C:\WINDOWS\SYSTEM32\dhcpcsvc.DLL
0x73e40000 - 0x73e49000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll
0x664c0000 - 0x67231000 C:\WINDOWS\SYSTEM32\nvd3dum.dll
0x17590000 - 0x176ca000 C:\WINDOWS\system32\nvspcap.dll
0x73cb0000 - 0x73cf0000 C:\WINDOWS\system32\powrprof.dll
0x6d480000 - 0x6d5ba000 C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPI.dll
0x76fc0000 - 0x77171000 C:\WINDOWS\SYSTEM32\SETUPAPI.dll
0x69800000 - 0x69820000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\sunec.dll
0x72bd0000 - 0x72be1000 C:\WINDOWS\system32\napinsp.dll
0x72bb0000 - 0x72bc6000 C:\WINDOWS\system32\pnrpnsp.dll
0x72c60000 - 0x72c74000 C:\WINDOWS\system32\NLAapi.dll
0x72b10000 - 0x72b1a000 C:\WINDOWS\System32\winrnr.dll
0x72ab0000 - 0x72ac0000 C:\WINDOWS\system32\wshbth.dll
0x697e0000 - 0x697f2000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\unpack.dll
0x697a0000 - 0x697d9000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\fontmanager.dll
0x69770000 - 0x697a0000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\t2k.dll
0x69620000 - 0x69645000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jpeg.dll
0x6b880000 - 0x6b88a000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jsound.dll
0x6b560000 - 0x6b569000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jsoundds.dll
0x6ceb0000 - 0x6cf31000 C:\WINDOWS\SYSTEM32\DSOUND.dll
0x6cf70000 - 0x6cfc3000 C:\WINDOWS\SYSTEM32\MMDevAPI.DLL
0x70800000 - 0x70836000 C:\WINDOWS\SYSTEM32\wdmaud.drv
0x6f930000 - 0x6f937000 C:\WINDOWS\SYSTEM32\ksuser.dll
0x6f920000 - 0x6f92a000 C:\WINDOWS\SYSTEM32\AVRT.dll
0x6cd80000 - 0x6cde0000 C:\WINDOWS\SYSTEM32\AUDIOSES.DLL
0x71ff0000 - 0x71ff9000 C:\WINDOWS\SYSTEM32\msacm32.drv
0x70f80000 - 0x70f88000 C:\WINDOWS\SYSTEM32\midimap.dll
0x76e90000 - 0x76f1d000 C:\WINDOWS\SYSTEM32\clbcatq.dll
0x68f20000 - 0x68f46000 C:\Users\Ned\jagexcache\runescape\LIVE\jaclib.dll
0x6a300000 - 0x6a306000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\jawt.dll
0x72090000 - 0x7209d000 C:\WINDOWS\system32\wbem\wbemprox.dll
0x720a0000 - 0x72106000 C:\WINDOWS\SYSTEM32\wbemcomn.dll
0x71ad0000 - 0x71ae1000 C:\WINDOWS\system32\wbem\wbemsvc.dll
0x71a00000 - 0x71ac4000 C:\WINDOWS\system32\wbem\fastprox.dll
0x69760000 - 0x6976c000 C:\WINDOWS\system32\winbrand.dll
0x77430000 - 0x7746d000 C:\WINDOWS\SYSTEM32\WINTRUST.dll
0x77730000 - 0x778b8000 C:\WINDOWS\SYSTEM32\CRYPT32.dll
0x75590000 - 0x7559e000 C:\WINDOWS\SYSTEM32\MSASN1.dll
0x68f50000 - 0x69239000 C:\WINDOWS\system32\nvapi.dll
0x69600000 - 0x6961a000 C:\Users\Ned\jagexcache\runescape\LIVE\jaggl.dll
0x54a90000 - 0x56258000 C:\WINDOWS\SYSTEM32\nvoglv32.DLL
0x73100000 - 0x7310f000 C:\WINDOWS\SYSTEM32\WTSAPI32.dll
0x75370000 - 0x75398000 C:\WINDOWS\SYSTEM32\ntmarta.dll
0x730b0000 - 0x730f5000 C:\WINDOWS\SYSTEM32\WINSTA.dll
0x68eb0000 - 0x68eba000 C:\Program Files (x86)\Java\jre1.8.0_25\bin\management.dll
0x664a0000 - 0x664b6000 C:\Users\Ned\jagexcache\runescape\LIVE\jagdx.dll
0x701d0000 - 0x701e6000 C:\WINDOWS\SYSTEM32\usp10.dll
0x6b730000 - 0x6b871000 C:\WINDOWS\SYSTEM32\dbghelp.dll
VM Arguments:
jvm_args: -Xbootclasspath/p:C:/Simba/Plugins//smart.jar
java_command: smart.Main C:/Simba/Plugins//libsmartjni32.dll http://world9.runescape.com/ ,f7649838988217813349 800 600 C:/Simba/Plugins/ OpenGL32.dll,d3d9.dll
java_class_path (initial): .;C:\Program Files (x86)\Java\jre1.8.0_31\lib\ext\QTJava.zip
Launcher Type: SUN_STANDARD
Environment Variables:
CLASSPATH=.;C:\Program Files (x86)\Java\jre1.8.0_31\lib\ext\QTJava.zip
PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Jav a\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDO WS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerS hell\v1.0\;C:\Program Files (x86)\Common Files\Avid;C:\Program Files\Common Files\Avid;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmd
USERNAME=Ned
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 8.1 , 64 bit Build 9600
CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, erms, ht, tsc, tscinvbit, tscinv
Memory: 4k page, physical 16681672k(13258348k free), swap 19172040k(14948508k free)
vm_info: Java HotSpot(TM) Client VM (25.31-b07) for windows-x86 JRE (1.8.0_31-b13), built on Dec 17 2014 20:46:12 by "java_re" with MS VC++ 10.0 (VS2010)
time: Sun May 24 00:24:54 2015
elapsed time: 178 seconds (0d 0h 2m 58s)
Yup. That's perfect. It's an Endscene crash:
HRESULT IDirect3DDevice9ProxyHook::EndScene()
{
if (font)
{
for (IDirect3DTexture9Proxy *tex : textures)
{
for (D3DXVECTOR3 &pt : tex->points)
{
font->Draw(pt.x, pt.y, D3DCOLOR_XRGB(0, 0xFF, 0), "%", tex->ID);
}
tex->points.clear(); //crash here.. tex may be NULL.
}
for (IDirect3DVertexBuffer9Proxy *mod : models)
{
for (D3DXVECTOR3 &pt : mod->points)
{
font->Draw(pt.x, pt.y, D3DCOLOR_XRGB(0xFF, 0, 0), "%", mod->ID);
}
mod->points.clear(); //crash here.. mod may be NULL.
}
}
textures.clear();
models.clear();
return IDirect3DDevice9Proxy::EndScene();
}
Most likely it's my for-loops lol. I didn't check for NULL before calling "clear" (such a noob mistake :(). I might even be able to speed it up more now that I know some textures are removed from the list (less to process) and do better rendering for larger screens (I'll try to turn that 40 into a 50 on larger resolutions). For now, I have a couple other things I want to complete as well.
Looks awesome Brandon. One thing that bothered me about OGL was that the repetitive (and seemingly useless) IDs such as 65539 in your test images clutter the screen. Can you add support for filtering them?
Brandon
05-24-2015, 04:54 AM
Looks awesome Brandon. One thing that bothered me about OGL was that the repetitive (and seemingly useless) IDs such as 65539 in your test images clutter the screen. Can you add support for filtering them?
Yeah you will be able to filter and/or remove them if you wish. You can also turn off rendering of certain models so those models aren't drawn on screen. Ex: Making a rock or character invisible but still being able to interact with it ;] but this functionality was just me playing around with things. I can guarantee the filtering of ID's but I may not allow you to remove models.
But again, I want to focus on speed first as this is a speed beta test and rendering test. Once I know all is good for the majority of testers, I will move onto ID's and such.
For now, I need ALL ID's to be on screen so we can know the limits of the plugin under stress that the current OpenGL one could not handle.
The Mayor
05-24-2015, 05:02 AM
Are we downloading the d3d9.dll from the OP? I get this when trying to spawn smart:
http://puu.sh/hYl3X/4b0bca5665.png
Brandon
05-24-2015, 05:03 AM
Are we downloading the d3d9.dll from the OP? I get this when trying to spawn smart
Yeah and that's fine. It prints that because I haven't enable the button for SMART yet. (IE: The "Enable Direct-X" button). It should still load it and should display everything.
The Mayor
05-24-2015, 05:08 AM
Yeah and that's fine. It prints that because I haven't enable the button for SMART yet. (IE: The "Enable Direct-X" button). It should still load it and should display everything.
I mean the 2nd line, it actually fails to load the plugin. I just put the dll in the plugins folder, and ran
program test;
{$DEFINE SMART}
{$i srl-6/srl.simba}
begin
setupSRL();
end.
Brandon
05-24-2015, 05:13 AM
I mean the 2nd line, it actually fails to load the plugin. I just put the dll in the plugins folder, and ran
program test;
{$DEFINE SMART}
{$i srl-6/srl.simba}
begin
setupSRL();
end.
https://www.microsoft.com/en-us/download/details.aspx?id=35
You don't have d3dx which the plugin uses for drawing the ID's on screen. I didn't have time to remove the dependency.
I get this when it loads: https://i.imgur.com/FeJIfNP.png but everything displays fine, so maybe not something to worry about.
Possibly not what you're wondering about, but for some reason SRL didn't detect that I was in the login screen.
Other than that everything appears to work fine. Great work, as usual :)
The Mayor
05-24-2015, 05:36 AM
https://www.microsoft.com/en-us/download/details.aspx?id=35
You don't have d3dx which the plugin uses for drawing the ID's on screen. I didn't have time to remove the dependency.
Thanks, working now! Seems just as smooth as the dx plugin even with the drawing.
I get this when it loads: https://i.imgur.com/FeJIfNP.png but everything displays fine, so maybe not something to worry about.
Possibly not what you're wondering about, but for some reason SRL didn't detect that I was in the login screen.
Other than that everything appears to work fine. Great work, as usual :)
What would be cool is if it was compatable with srl so I could run a script for 24h with the drawing and see if there is any fps issues after a few hours.
Brandon
05-24-2015, 05:54 AM
I get this when it loads: https://i.imgur.com/FeJIfNP.png but everything displays fine, so maybe not something to worry about.
Possibly not what you're wondering about, but for some reason SRL didn't detect that I was in the login screen.
Other than that everything appears to work fine. Great work, as usual :)
Ignore that. I added that so that I can detect older and newer graphics. Old versions of Direct-X may not have some functions but as long as it loads, it will not affect you in any way. New versions may have more or less functions as well.
You should probably see the exact same error code when using the SRL Direct-X colour plugin as it's the same error logging/loading scheme (unless I forgot to enable it).
A lot of people don't have that function so for SRL-6 I had disabled it (no side-effects): https://github.com/Brandon-T/DXI/blob/master/d3d9/Hooks/Exports.cpp#L29
SRL did not detect anything because SMART's interface is not enabled. Don't worry about all of this for now. What is the FPS like? Did it crash? Any logs?
Thanks, working now! Seems just as smooth as the dx plugin even with the drawing.
What would be cool is if it was compatable with srl so I could run a script for 24h with the drawing and see if there is any fps issues after a few hours.
Good FPS? Did it crash? Any logs? You'll get to test lengthier times with scripts once the communication is enabled.
The Mayor
05-24-2015, 06:00 AM
Ignore that. I added that so that I can detect older graphics. Old versions of Direct-X may not have some functions but as long as it loads, it will not affect you in any way.
You should probably see the exact same error code when using the SRL Direct-X colour plugin as it's the same error logging/loading scheme (unless I forgot to enable it).
SRL did not detect anything because SMART's interface is not enabled. What is the FPS like?
Good FPS? You'll get to test lengthier times with scripts once the communication is enabled.
Yea fps is great. It is actually less laggy drawing all the IDs when running around than OpenGL is without drawing anything (even the colour only openGL plugin).
Looking forward to the enabled communication :D
Ignore that. I added that so that I can detect older and newer graphics. Old versions of Direct-X may not have some functions but as long as it loads, it will not affect you in any way. New versions may have more or less functions as well.
You should probably see the exact same error code when using the SRL Direct-X colour plugin as it's the same error logging/loading scheme (unless I forgot to enable it).
A lot of people don't have that function so for SRL-6 I had disabled it (no side-effects): https://github.com/Brandon-T/DXI/blob/master/d3d9/Hooks/Exports.cpp#L29
SRL did not detect anything because SMART's interface is not enabled. Don't worry about all of this for now. What is the FPS like?
FPS is great. No noticeable change from the normal plugin.
Thomas
05-24-2015, 06:54 AM
Yeah you will be able to filter and/or remove them if you wish. You can also turn off rendering of certain models so those models aren't drawn on screen. Ex: Making a rock or character invisible but still being able to interact with it ;] but this functionality was just me playing around with things. I can guarantee the filtering of ID's but I may not allow you to remove models.
But again, I want to focus on speed first as this is a speed beta test and rendering test. Once I know all is good for the majority of testers, I will move onto ID's and such.
For now, I need ALL ID's to be on screen so we can know the limits of the plugin under stress that the current OpenGL one could not handle.
So in the end we might even be able to not render any of the models, but still interact with them? That could lead to some serious power and resources savings.
How long would it take you to update this whenever directx12 gets released?
Great work as usual, will try the plug-in later!
Brandon
05-24-2015, 01:47 PM
So in the end we might even be able to not render any of the models, but still interact with them? That could lead to some serious power and resources savings.
How long would it take you to update this whenever directx12 gets released?
Great work as usual, will try the plug-in later!
Yes you can disable the rendering of models but still interact with them for resource saving if I do add that.
You're asking me an impossible question. "How long"? Remember this is done in my free-time only. Sometimes it seems like I take forever to make a release when in reality the total amount of code is about an hour of work. The current plugin on the OP has about 2 hours of work put in and most of that work is just wrappers (not hooks). Hooks are about 10 - 20 minutes of work. Once all the bases are hooked, hooks can take a couple seconds to a couple minutes. Calculations and math aren't part of the time taken. Those were already done and I usually have a bunch of files I just include into the project that were written prior to starting.
Ex.. (ALL of the hooks code is in this one file -- not the wrappers):
#include "IDirect3DDevice9ProxyHook.hxx"
#include "Memory.hxx"
#include "Graphics.hxx"
#include "Math.hxx"
#include "Export.hxx"
//Todo: move back to Math.cxx
D3DXVECTOR3 GetVertex(const std::uint8_t *vertices, std::int16_t index, std::uint16_t stride)
{
D3DXVECTOR3 res = {0};
memcpy(&res.x, &vertices[index * stride], sizeof(float));
memcpy(&res.y, &vertices[index * stride + sizeof(float)], sizeof(float));
memcpy(&res.z, &vertices[index * stride + sizeof(float) * 2], sizeof(float));
return res;
}
//Todo: move back to Math.cxx
void GetVertices(std::vector<D3DXVECTOR3> &verts, IDirect3DVertexBuffer9 *VertexBuffer, IDirect3DIndexBuffer9 *IndexBuffer, std::uint32_t BaseVertexIndex, std::uint32_t StartIndex, std::uint32_t PrimCount, std::uint32_t Stride)
{
const std::uint8_t *vertices = NULL;
const std::uint16_t *indices = NULL;
UINT EndIndex = StartIndex + (PrimCount * 3);
vertices = reinterpret_cast<const std::uint8_t*>(reinterpret_cast<IDirect3DVertexBuffer9Proxy*>(VertexBuffer)->InternalBuffer());
indices = reinterpret_cast<const std::uint16_t*>(reinterpret_cast<IDirect3DIndexBuffer9Proxy*>(IndexBuffer)->InternalBuffer()) + PrimCount * 3 * sizeof(std::uint16_t);
verts.resize(EndIndex - StartIndex);
for (UINT I = StartIndex, J = 0; I < EndIndex; ++I, ++J)
{
verts[J] = GetVertex(vertices, indices[I] + BaseVertexIndex, Stride);
}
}
//Todo: Move back to Math.cxx
D3DXVECTOR3 IDirect3DDevice9ProxyHook::WorldToScreen(IDirect3D Device9* pDevice, D3DXVECTOR3 in)
{
D3DXVECTOR3 out;
IDirect3DDevice9Proxy::GetVertexShaderConstantF(0, reinterpret_cast<float*>(&wvp), 4);
D3DXMatrixTranspose(&wvp, &wvp);
D3DXVec3TransformCoord(&out, &in, &wvp);
return D3DXVECTOR3((out.x + 1.0f) * vp.Width * 0.5f + vp.X, (1.0f - out.y) * vp.Height * 0.5f + vp.Y, out.z);
}
//Todo: Move back to Math.cxx
D3DXVECTOR3 IDirect3DDevice9ProxyHook::WorldToScreen2(IDirect3 DDevice9* pDevice, D3DXVECTOR3 in)
{
D3DXVECTOR3 out;
D3DXVec3Project(&out, &in, &vp, &proj, &view, &world);
return out;
}
//Hooks
IDirect3DDevice9ProxyHook::IDirect3DDevice9ProxyHo ok(IDirect3DDevice9* pOriginal) : IDirect3DDevice9Proxy(pOriginal)
{
}
IDirect3DDevice9ProxyHook::~IDirect3DDevice9ProxyH ook()
{
}
ULONG IDirect3DDevice9ProxyHook::AddRef()
{
++references;
return IDirect3DDevice9ProxyHook::AddRef();
}
ULONG IDirect3DDevice9ProxyHook::Release()
{
if (--references == 0)
{
font.reset(nullptr);
pTexture = nullptr;
pIndexBuffer = nullptr;
pVertexBuffer = nullptr;
}
return IDirect3DDevice9ProxyHook::Release();
}
//Override rendering
HRESULT IDirect3DDevice9ProxyHook::DrawPrimitive(D3DPRIMIT IVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount)
{
if (pTexture)
{
D3DXVECTOR3 vertex = WorldToScreen(pOriginal);
pTexture->points.push_back(out);
if (std::find(textures.begin(), textures.end(), pTexture) == textures.end())
{
textures.push_back(pTexture); //animated texture.
}
}
return IDirect3DDevice9Proxy::DrawPrimitive(PrimitiveType , StartVertex, PrimitiveCount);
}
HRESULT IDirect3DDevice9ProxyHook::DrawIndexedPrimitive(D3 DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{
if (pTexture && pIndexBuffer && pVertexBuffer && (primCount == 2 || NumVertices == 4))
{
if (PrimitiveType == D3DPT_TRIANGLELIST)
{
DWORD fvf = 0;
IDirect3DDevice9Proxy::GetFVF(&fvf);
std::vector<D3DXVECTOR3> verts;
//Might be way more efficient to get the top left coord + the size / 2 for mid point.
GetVertices(verts, pVertexBuffer, pIndexBuffer, BaseVertexIndex, startIndex, primCount, GVMath::CalculateStride(fvf));
if (font && verts.size())
{
D3DXVECTOR3 in = {(verts[0].x + verts[4].x) / 2.0f, (verts[0].y + verts[4].y) / 2.0f, 0};
D3DXVECTOR3 out = WorldToScreen2(this->Original(), in);
pTexture->points.push_back(out);
if (std::find(textures.begin(), textures.end(), pTexture) == textures.end())
{
textures.push_back(pTexture); //regular texture.
}
}
}
}
else if (pVertexBuffer)
{
unsigned int ID = GenId(PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
D3DXVECTOR3 out = WorldToScreen(this->Original());
pVertexBuffer->ID = ID;
pVertexBuffer->points.push_back(out);
if (std::find(models.begin(), models.end(), pVertexBuffer) == models.end())
{
models.push_back(pVertexBuffer); //model.
}
}
return IDirect3DDevice9Proxy::DrawIndexedPrimitive(Primit iveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
HRESULT IDirect3DDevice9ProxyHook::BeginScene()
{
HRESULT res = IDirect3DDevice9Proxy::BeginScene();
if (!font)
{
font.reset(new Font(this->Original(), "Arial", 8));
}
//Cache all matrices for speed once per frame or perhaps move this to once per load.
IDirect3DDevice9Proxy::GetViewport(&vp);
IDirect3DDevice9Proxy::GetTransform(D3DTS_VIEW, &view);
IDirect3DDevice9Proxy::GetTransform(D3DTS_PROJECTI ON, &proj);
IDirect3DDevice9Proxy::GetTransform(D3DTS_WORLD, &world);
return res;
}
HRESULT IDirect3DDevice9ProxyHook::EndScene()
{
if (font)
{
for (IDirect3DTexture9Proxy *tex : textures) //todo: check if tex is null.
{
for (D3DXVECTOR3 &pt : tex->points)
{
font->Draw(pt.x, pt.y, D3DCOLOR_XRGB(0, 0xFF, 0), "%", tex->ID);
}
tex->points.clear();
}
for (IDirect3DVertexBuffer9Proxy *mod : models) //todo: check if mod is null.
{
for (D3DXVECTOR3 &pt : mod->points)
{
font->Draw(pt.x, pt.y, D3DCOLOR_XRGB(0xFF, 0, 0), "%", mod->ID);
}
mod->points.clear();
}
}
textures.clear();
models.clear();
return IDirect3DDevice9Proxy::EndScene();
}
HRESULT IDirect3DDevice9ProxyHook::Reset(D3DPRESENT_PARAME TERS* pPresentationParameters)
{
if (font)
font->OnLostDevice();
HRESULT res = IDirect3DDevice9Proxy::Reset(pPresentationParamete rs);
if (font)
font->OnResetDevice();
return res;
}
//Override creations
HRESULT IDirect3DDevice9ProxyHook::CreateAdditionalSwapCha in(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain)
{
HRESULT res = IDirect3DDevice9Proxy::CreateAdditionalSwapChain(p PresentationParameters, pSwapChain);
if (res == D3D_OK)
{
*pSwapChain = new IDirect3DSwapChain9Proxy(*pSwapChain);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle)
{
HRESULT res = IDirect3DDevice9Proxy::CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle);
if (res == D3D_OK)
{
*ppTexture = new IDirect3DTexture9Proxy(*ppTexture, Width, Height, Format);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle)
{
HRESULT res = IDirect3DDevice9Proxy::CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle);
if (res == D3D_OK)
{
*ppVertexBuffer = new IDirect3DVertexBuffer9Proxy(*ppVertexBuffer, Length);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle)
{
HRESULT res = IDirect3DDevice9Proxy::CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle);
if (res == D3D_OK)
{
*ppIndexBuffer = new IDirect3DIndexBuffer9Proxy(*ppIndexBuffer, Length);
}
return res;
}
//Override setters
HRESULT IDirect3DDevice9ProxyHook::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture)
{
this->pTexture = nullptr;
if (pTexture && pTexture->GetType() == D3DRTYPE_TEXTURE)
{
this->pTexture = static_cast<IDirect3DTexture9Proxy*>(pTexture);
return IDirect3DDevice9Proxy::SetTexture(Stage, static_cast<IDirect3DTexture9Proxy*>(pTexture)->Original());
}
return IDirect3DDevice9Proxy::SetTexture(Stage, pTexture);
}
HRESULT IDirect3DDevice9ProxyHook::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride)
{
this->pVertexBuffer = nullptr;
if (pStreamData && pStreamData->GetType() == D3DRTYPE_VERTEXBUFFER)
{
this->pVertexBuffer = static_cast<IDirect3DVertexBuffer9Proxy*>(pStreamData);
return IDirect3DDevice9Proxy::SetStreamSource(StreamNumbe r, static_cast<IDirect3DVertexBuffer9Proxy*>(pStreamData)->Original(), OffsetInBytes, Stride);
}
return IDirect3DDevice9Proxy::SetStreamSource(StreamNumbe r, pStreamData, OffsetInBytes, Stride);
}
HRESULT IDirect3DDevice9ProxyHook::SetIndices(IDirect3DInd exBuffer9* pIndexData)
{
this->pIndexBuffer = nullptr;
if (pIndexData && pIndexData->GetType() == D3DRTYPE_INDEXBUFFER)
{
this->pIndexBuffer = static_cast<IDirect3DIndexBuffer9Proxy*>(pIndexData);
return IDirect3DDevice9Proxy::SetIndices(static_cast<IDirect3DIndexBuffer9Proxy*>(pIndexData)->Original());
}
return IDirect3DDevice9Proxy::SetIndices(pIndexData);
}
//Override consumers
HRESULT IDirect3DDevice9ProxyHook::GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain)
{
HRESULT res = IDirect3DDevice9Proxy::GetSwapChain(iSwapChain, pSwapChain);
if (res == D3D_OK)
{
*pSwapChain = new IDirect3DSwapChain9Proxy(*pSwapChain);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags)
{
return IDirect3DDevice9Proxy::ProcessVertices(SrcStartInd ex, DestIndex, VertexCount, static_cast<IDirect3DVertexBuffer9Proxy*>(pDestBuffer)->Original(), pVertexDecl, Flags);
}
Testing takes a while, wrappers take a couple minutes each. Overall, an update to Direct-X 12 is a different ball game but would take around the same amount of time. If I had one weekend free, I would be able to release a plugin with a ton of features.
Thomas
05-24-2015, 02:14 PM
Brandon
I didn't mean for a time on it, was just wondering if you have anticipated on directx 12, and if you expect it to require allot of work to fix the plug-in :)
Brandon
05-24-2015, 02:52 PM
[mention]brandon[/brandon]
I didn't mean for a time on it, was just wondering if you have anticipated on directx 12, and if you expect it to require allot of work to fix the plug-in :)
Yeah I've been keeping up with Direct-X 12 (game programming). So long as the COMM interface doesn't change much from Direct-X 11 (and it most likely won't), then it won't take long to write a port.
And I don't expect it to require a lot of work for a port at all. It's all just COMM and it's usually very simple. I've only been keeping up with what's on villavu in regards to the NXT client which will supposedly use Direct-X 12. It's C++ and ASM so it's my playground. I don't usually visit the RS website unless someone posts something interesting on here that caught my eye.
All other code such as communication with Simba and the SMART interface would be the same (copy paste). Direct-X 11 is a lot easier than 9 as they provide a lot of built in things (especially for math, drawing, efficiency) and I expect 12 to be a lot easier than 11. Once you know one, you pretty much know all.
Thomas
05-31-2015, 11:47 AM
You'll get to test lengthier times with scripts once the communication is enabled.
Have you perhaps had some free time to enable communication?
I'm so impatient, I know...
Also will we be able to read renderend text? Or just models/textures?
Brandon
05-31-2015, 01:52 PM
Have you perhaps had some free time to enable communication?
I'm so impatient, I know...
Also will we be able to read renderend text? Or just models/textures?
I enabled communication last night. I have to test it first then I will do a release with a description of everything that needs to be tested by you guys. It seems like I may only be able to do a release every Sunday or Saturday until maybe next week or so.
For the comment about "text" recognition. I know how it works and I have the logic for it written but it will be one of the very last features to be enabled. I say this because I got screwed royally in OpenGL with the text recognition (although I have a fix for it now), I'd like to do it correctly in Direct-X the first time around. In OpenGL, it was done in the dumbest way now that I look back on it.
Direct-X uses the same kind of fonts for text: "textured fonts" aka "bitmap fonts" and the algorithm is the same as the new OpenGL algorithm but I want to make sure it is 10000% right and fast. You can see information about the new way of doing it on the OpenGL thread.
I've also been working on getting rid of the D3DX dependency and writing my own algorithms which is just as fast for matrix multiplication, projection/unprojection, etc.. D3DX dependency requires the user to install the Direct-X end-user runtime. (See The Mayor's installation problem above).
For now, I will enable communication for the back-buffer so that Simba/SMART can read colours, models and textures.
Thomas
05-31-2015, 03:39 PM
Great! Take your time, I'm sure it'll be flawless soon enough. (Still hoping the same for ogl).
Too bad I need perfect text recognition for my next script. And ogl just keeps becoming a lagfest.
Do you think if I do write that script, but use OGL, it'll be somewhat similar in directx?
Perhaps it'll still be better to just wait for your release instead of porting over an OGL script and having a sloppy script..
*edit*
I'm getting crashes rather often on my laptop. (SMART Client closes)
Windows 10 Pro 64-bit
Intel Core 2 Duo P7350 @ 2.00
nVidia GT130M 1GB.
Using 800x600 resolution, unsure what kind of crash report I can find.
Simba doesn't report anything.
It crashes ingame whenever it tries to load some new stuff, it kind of lags for me once I get logged in, then whenever I do something somewhat requiring CPU/GPU it crashes.
Just tried my desktop, also crashes the SMART client. It does load them though, and displays the debug in lobby, but once I try to login into a game server it crashes.
*edit*
Doesn't crash once I stop the script, atleast on desktop.
Rightclick options menu has some weird debug on it, like a ton of duplicate debugs stacked it seems.
alar82
06-05-2015, 10:00 PM
Omg performance GAINZ 45-50 fps on my old computer and no performance degradation on teleport. I have amd fx-8320 cpu and r290=)
Its sad that dont play(bot) rs anymore, I hate this p2w ****.
26082
Hi Brandon, any update on this?
willmcb18
06-19-2015, 04:58 PM
interesting idea
Forty Two
06-25-2015, 12:36 AM
I don't have the post count to PM, but maybe I can get help with this idea here.
I found that terrain always has a start index of 0 and the stride is 20 and I can read an array of all the vertices.
I am trying to map the vertices to 2d points on the screen, but I don't seem to be able to get the proper transformation matrices.
I hope to be able to map every 3D vertex to a 2D mesh and be able to click every individual tile for onscreen pathing.
Here is what I am trying to do:
pDevice->GetVertexShaderConstantF(0, WVP_matrix, 4); //This is [D3DXPC_MATRIX_COLUMNS] AKA column major
for (int i = 0; i < num; i++){
obj_matrix._11 = vertices[i].x;
obj_matrix._12 = vertices[i].y;
obj_matrix._13 = vertices[i].z;
obj_matrix._14 = 1;
D3DXMatrixMultiply(&obj_matrix, &obj_matrix, &WVP_matrix);
DrawCrosshair(viewPort.Width / 2.0 + obj_matrix._11, viewPort.Height / 2.0 + obj_matrix._12);
}
http://www.unknowncheats.me/forum/d3d-tutorials-and-source/58666-world-screen-shader-driven-games.html
I disassembled the shaders (reference link above)and was shocked to find that all three matrices needed for projection were already multiplied and waiting. (Been trying to find them separately for hours.)
So now I have a mostly working translation of object vertices to screen coordinates.
Here debug output of the terrain object. http://imgur.com/ZttWhpJ
I just realised that because I am pulling these vertices from the vertex buffer in drawIndexedPrimitive, they are all relative to the origin of that model. So I need to grab the models themselves to get the world position and rotation data.
There are 1388 vertices being draw in this image.
26256
I will probably port this to OpenGL since development seems more active. I hate the DirectX monopoly anyway. :L
Lucidity
07-08-2015, 09:01 PM
Seems to work fine for me.
http://puu.sh/iS17a/18178222ad.png
http://puu.sh/iS18y/63f4373a64.png
Brandon
07-09-2015, 01:02 AM
I don't have the post count to PM, but maybe I can get help with this idea here.
I will probably port this to OpenGL since development seems more active. I hate the DirectX monopoly anyway. :L
I didn't delete you or anyone. I haven't been getting many tags or PM's recently and I've been extremely busy lately. Not sure if you really want to go the OpenGL route but if you do, you should be careful of fonts/text!
For those wondering how far I got.. I got as far as sending all the data to Simba.. I just haven't been able to test and do optimizations and stuff lately. That's why I haven't released anything yet.
Anyway, use the file below for projections and most of the math is done.. I created it because doing it myself is actually faster than using D3DX Math. I use "CalculateStride" to get the stride from the FVF rather than increasing the reference count to the VertexBuffer and Releasing it just to get a stride (extremely costly).
The bounding box formula is for getting a box around a list of vertices (you can get the bounding box of models, textures, etc..) Below the math class, you'll see an example on how I project the vertices to the screen.
I'll try to upload the rest to github as soon as I can.. For now:
#ifndef MATH_HXX_INCLUDED
#define MATH_HXX_INCLUDED
#include <cmath>
#include <cstdint>
#include <algorithm>
#include <d3dx9.h>
class Mat4;
struct Vec3
{
public:
float x, y, z;
Vec3() : x(0), y(0), z(0) {}
Vec3(float x, float y, float z) : x(x), y(y), z(z) {}
inline Vec3 Cross(const Vec3 &v) const;
inline float Dot(const Vec3 &v) const;
inline Vec3 Normalise() const;
inline int Magnitude() const;
inline Vec3 Scale(const float val) const;
inline Vec3 operator + (const Vec3 &v) const;
inline Vec3 operator - (const Vec3 &v) const;
inline Vec3 operator * (const float val) const;
inline Vec3 operator / (const float val) const;
Vec3 Transform(Mat4* mat) const;
Vec3 Transform(const Mat4 &mat) const;
Vec3 Project(D3DVIEWPORT9* viewport, Mat4* world, Mat4* view, Mat4* projection) const;
Vec3 Project(const D3DVIEWPORT9 &viewport, const Mat4 &world, const Mat4 &view, const Mat4 &projection) const;
};
class Mat4
{
private:
float mat[4][4];
public:
Mat4() : mat{0} {}
float* operator[](const int index) {return mat[index];}
const float* operator[](const int index) const {return mat[index];}
Mat4 operator * (const Mat4 &m) const;
Mat4 operator + (const Mat4 &m) const;
Mat4 operator - (const Mat4 &m) const;
Mat4& Transpose();
Mat4 Transpose() const;
static Mat4 Identity();
static Mat4 Orthagonal(float w, float h, float zNear, float zFar);
static Mat4 Perspective(float w, float h, float zNear, float zFar);
static Mat4 FieldOfView(float fov, float aspect, float zNear, float zFar);
static Mat4 LookAt(const Vec3& Eye, const Vec3& At, const Vec3& Up);
static Mat4 RotX(float rad);
static Mat4 RotY(float rad);
static Mat4 RotZ(float rad);
static Mat4 Rot(float pitch, float yaw, float roll);
static Mat4 Scale(float val);
static Mat4 Scale(float x, float y, float z);
static Mat4 Translate(float x, float y, float z);
};
namespace DXMath
{
unsigned int CalculateStride(unsigned int FVF);
unsigned int CalculateBitsPerPixel(D3DFORMAT format);
#ifdef D3DX_SUPPORT
D3DXVECTOR3 WorldToScreen(D3DXMATRIX* WorldViewProjection, D3DVIEWPORT9* ViewPort, const D3DXVECTOR3 &in = {0, 0, 0});
D3DXVECTOR3 WorldToScreen2(D3DVIEWPORT9* ViewPort, D3DXMATRIX* World, D3DXMATRIX* View, D3DXMATRIX* Projection, const D3DXVECTOR3 &in = {0, 0, 0});
#else
Vec3 WorldToScreen(Mat4* WorldViewProjection, D3DVIEWPORT9* ViewPort, const Vec3 &in = {0, 0, 0});
Vec3 WorldToScreen2(D3DVIEWPORT9* ViewPort, Mat4* World, Mat4* View, Mat4* Projection, const Vec3 &in = {0, 0, 0});
#endif
}
namespace GVMath
{
typedef struct {float X1, Y1, X2, Y2;} Box2D;
typedef struct {float X1, Y1, Z1, X2, Y2, Z2;} Box3D;
static const double PI = 3.1415926535897932384626433832795;
Vec3 GetEulerAngles(float (&mat)[16], bool RowMajor);
Vec3 GetEulerAngles(float (&mat)[4][4], bool RowMajor);
float Distance(float (&a)[2], float (&b)[2]);
float Distance(float (&a)[3], float (&b)[3]);
Box2D BoundingBox(float* x, float* y, std::size_t size);
Box3D BoundingBox(float* x, float* y, float* z);
std::uint32_t ColourChecksum(const void* data, std::size_t width, std::size_t height);
std::uint32_t FullColourChecksum(const void* data, std::size_t width, std::size_t height, std::size_t offset = 0);
std::uint32_t Adler32(const std::uint8_t* data, std::size_t size);
std::uint32_t CRC32(const void* Data, size_t Size, std::uint32_t InitialValue = 0xFFFFFFFF);
}
#endif // MATH_HXX_INCLUDED
#include "Math.hxx"
Vec3 Vec3::Cross(const Vec3 &v) const
{
return Vec3((y * v.z) - (z * v.y), (z * v.x) - (x * v.z), (x * v.y) - (y * v.x));
}
float Vec3::Dot(const Vec3 &v) const
{
return ((x * v.x) + (y * v.y) + (z * v.z));
}
Vec3 Vec3::Normalise() const
{
int size = Magnitude();
return Vec3(x / size, y / size, z / size);
}
int Vec3::Magnitude() const
{
return sqrtf((x * x) + (y * y) + (z * z));
}
Vec3 Vec3::Scale(const float val) const
{
return Vec3(x * val, y * val, z * val);
}
Vec3 Vec3::operator + (const Vec3 &v) const
{
return Vec3(x + v.x, y + v.y, z + v.z);
}
Vec3 Vec3::operator - (const Vec3 &v) const
{
return Vec3(x - v.x, y - v.y, z - v.z);
}
Vec3 Vec3::operator * (const float val) const
{
return Vec3(x * val, y * val, z * val);
}
Vec3 Vec3::operator / (const float val) const
{
return Vec3(x / val, y / val, z / val);
}
Vec3 Vec3::Transform(Mat4* mat) const
{
Vec3 res;
float normal = (*mat)[0][3] * x + (*mat)[1][3] * y + (*mat)[2][3] * z + (*mat)[3][3];
if (normal)
{
res.x = ((*mat)[0][0] * x + (*mat)[1][0] * y + (*mat)[2][0] * z + (*mat)[3][0]) / normal;
res.y = ((*mat)[0][1] * x + (*mat)[1][1] * y + (*mat)[2][1] * z + (*mat)[3][1]) / normal;
res.z = ((*mat)[0][2] * x + (*mat)[1][2] * y + (*mat)[2][2] * z + (*mat)[3][2]) / normal;
}
return res;
}
Vec3 Vec3::Transform(const Mat4 &mat) const
{
Vec3 res;
float normal = mat[0][3] * x + mat[1][3] * y + mat[2][3] * z + mat[3][3];
if (normal)
{
res.x = (mat[0][0] * x + mat[1][0] * y + mat[2][0] * z + mat[3][0]) / normal;
res.y = (mat[0][1] * x + mat[1][1] * y + mat[2][1] * z + mat[3][1]) / normal;
res.z = (mat[0][2] * x + mat[1][2] * y + mat[2][2] * z + mat[3][2]) / normal;
}
return res;
}
Vec3 Vec3::Project(D3DVIEWPORT9* viewport, Mat4* world, Mat4* view, Mat4* projection) const
{
for (short i = 0; i < 4; ++i)
{
for (short j = 0; j < 4; ++j)
{
(*world)[i][j] = (*world)[i][0] * (*view)[0][j] + (*world)[i][1] * (*view)[1][j] + (*world)[i][2] * (*view)[2][j] + (*world)[i][3] * (*view)[3][j];
}
}
for (short i = 0; i < 4; ++i)
{
for (short j = 0; j < 4; ++j)
{
(*world)[i][j] = (*world)[i][0] * (*projection)[0][j] + (*world)[i][1] * (*projection)[1][j] + (*world)[i][2] * (*projection)[2][j] + (*world)[i][3] * (*projection)[3][j];
}
}
Vec3 res = this->Transform(world);
res.x = viewport->X + (1.0f + res.x) * viewport->Width / 2.0f;
res.y = viewport->Y + (1.0f - res.y) * viewport->Height / 2.0f;
res.z = viewport->MinZ + res.z * (viewport->MaxZ - viewport->MinZ);
return res;
}
Vec3 Vec3::Project(const D3DVIEWPORT9 &viewport, const Mat4 &world, const Mat4 &view, const Mat4 &projection) const
{
Mat4 wv = world * view;
Mat4 wvp = wv * projection;
Vec3 res = this->Transform(wvp);
res.x = viewport.X + (1.0f + res.x) * viewport.Width / 2.0f;
res.y = viewport.Y + (1.0f - res.y) * viewport.Height / 2.0f;
res.z = viewport.MinZ + res.z * (viewport.MaxZ - viewport.MinZ);
return res;
}
Mat4 Mat4::operator * (const Mat4 &m) const
{
Mat4 res;
for (short i = 0; i < 4; ++i)
{
for (short j = 0; j < 4; ++j)
{
//#error come back..
/*float sum = 0.0f;
for (short k = 0; k < 4; ++k)
{
sum += mat[i][k] * res[k][j];
}
res[i][j] = sum;*/
res[i][j] = mat[i][0] * m[0][j] + mat[i][1] * m[1][j] + mat[i][2] * m[2][j] + mat[i][3] * m[3][j];
}
}
return res;
}
Mat4 Mat4::operator + (const Mat4 &m) const
{
Mat4 res;
for (short i = 0; i < 4; ++i)
{
for (short j = 0; j < 4; ++j)
{
res[i][j] = mat[i][j] + m[i][j];
}
}
return res;
}
Mat4 Mat4::operator - (const Mat4 &m) const
{
Mat4 res;
for (short i = 0; i < 4; ++i)
{
for (short j = 0; j < 4; ++j)
{
res[i][j] = mat[i][j] - m[i][j];
}
}
return res;
}
Mat4& Mat4::Transpose()
{
for (int i = 0; i < 4; ++i)
{
for (int j = 0; j < 4; ++j)
{
mat[j][i] = mat[i][j];
}
}
return *this;
}
Mat4 Mat4::Transpose() const
{
Mat4 res;
for (int i = 0; i < 4; ++i)
{
for (int j = 0; j < 4; ++j)
{
res[j][i] = mat[i][j];
}
}
return res;
}
Mat4 Mat4::Identity()
{
Mat4 res;
res[0][0] = 1.0f;
res[1][1] = 1.0f;
res[2][2] = 1.0f;
res[3][3] = 1.0f;
return res;
}
Mat4 Mat4::Orthagonal(float w, float h, float zNear, float zFar)
{
Mat4 res;
res[0][0] = 2.0f / w;
res[1][1] = 2.0f / h;
res[2][2] = 1.0f / (zNear - zFar);
res[3][2] = zNear / (zNear - zFar);
res[3][3] = 1.0f;
return res;
}
Mat4 Mat4::Perspective(float w, float h, float zNear, float zFar)
{
Mat4 res;
res[0][0] = 2.0f * zNear / w;
res[1][1] = 2.0f * zNear / h;
res[2][2] = zFar / (zNear - zFar);
res[3][2] = zFar * zNear / (zNear - zFar);
res[2][3] = -1.0f;
return res;
}
Mat4 Mat4::FieldOfView(float fov, float aspect, float zNear, float zFar)
{
Mat4 res;
res[0][0] = 1.0f / tanf(fov / 2.0f);
res[1][1] = aspect / tanf(fov / 2.0f);
res[2][2] = zFar / (zFar - zNear);
res[3][2] = (zFar * zNear) / (zNear - zFar);
res[2][3] = -1.0f;
res[3][3] = 0.0f;
return res;
}
Mat4 Mat4::LookAt(const Vec3& Eye, const Vec3& At, const Vec3& Up)
{
Vec3 XAxis, YAxis, ZAxis;
ZAxis = (Eye - At).Normalise();
XAxis = (Up.Cross(ZAxis)).Normalise();
YAxis = (ZAxis.Cross(XAxis)).Normalise();
Mat4 res;
res[0][0] = XAxis.x;
res[1][0] = XAxis.y;
res[2][0] = XAxis.z;
res[3][0] = -XAxis.Dot(Eye);
res[0][1] = YAxis.x;
res[1][1] = YAxis.y;
res[2][1] = YAxis.z;
res[3][1] = -YAxis.Dot(Eye);
res[0][2] = ZAxis.x;
res[1][2] = ZAxis.y;
res[2][2] = ZAxis.z;
res[3][2] = -ZAxis.Dot(Eye);
res[3][3] = 1.0f;
return res;
}
Mat4 Mat4::RotX(float rad)
{
float ct = cosf(rad);
float st = sinf(rad);
Mat4 res = Identity();
res[1][1] = ct;
res[1][2] = st;
res[2][1] = -st;
res[2][2] = ct;
return res;
}
Mat4 Mat4::RotY(float rad)
{
float ct = cosf(rad);
float st = sinf(rad);
Mat4 res = Identity();
res[0][0] = ct;
res[0][2] = st;
res[2][0] = -st;
res[2][2] = ct;
return res;
}
Mat4 Mat4::RotZ(float rad)
{
float ct = cosf(rad);
float st = sinf(rad);
Mat4 res = Identity();
res[0][0] = ct;
res[0][1] = st;
res[1][0] = -st;
res[1][1] = ct;
return res;
}
Mat4 Mat4::Rot(float pitch, float yaw, float roll)
{
return RotY(yaw) * RotX(pitch) * RotZ(roll);
}
Mat4 Mat4::Scale(float val)
{
return Scale(val, val, val);
}
Mat4 Mat4::Scale(float x, float y, float z)
{
Mat4 res;
res[0][0] = x;
res[1][1] = y;
res[2][2] = z;
res[3][3] = 1.0f;
return res;
}
Mat4 Mat4::Translate(float x, float y, float z)
{
Mat4 res;
res[3][0] = x;
res[3][1] = y;
res[3][2] = z;
res[0][0] = 1.0f;
res[1][1] = 1.0f;
res[2][2] = 1.0f;
res[3][3] = 1.0f;
return res;
}
namespace DXMath
{
unsigned int CalculateStride(unsigned int FVF)
{
return ((FVF | D3DFVF_XYZ) == FVF) * 12 +
((FVF | D3DFVF_XYZRHW) == FVF) * 12 +
((FVF | D3DFVF_XYZB1) == FVF) * 12 +
((FVF | D3DFVF_XYZB2) == FVF) * 12 +
((FVF | D3DFVF_XYZB3) == FVF) * 12 +
((FVF | D3DFVF_XYZB4) == FVF) * 12 +
((FVF | D3DFVF_XYZB5) == FVF) * 12 +
((FVF | D3DFVF_XYZW) == FVF) * 12 +
((FVF | D3DFVF_NORMAL) == FVF) * 12 +
((FVF | D3DFVF_DIFFUSE) == FVF) * 4 +
((FVF | D3DFVF_SPECULAR) == FVF) * 4 +
((FVF | D3DFVF_TEX1) == FVF) * 8 +
((FVF | D3DFVF_TEX2) == FVF) * 8 +
((FVF | D3DFVF_TEX3) == FVF) * 8 +
((FVF | D3DFVF_TEX4) == FVF) * 8 +
((FVF | D3DFVF_TEX5) == FVF) * 8 +
((FVF | D3DFVF_TEX6) == FVF) * 8 +
((FVF | D3DFVF_TEX7) == FVF) * 8 +
((FVF | D3DFVF_TEX8) == FVF) * 8;
}
unsigned int CalculateBitsPerPixel(D3DFORMAT format)
{
switch(format)
{
case D3DFMT_A16B16G16R16: return 64;
case D3DFMT_A8R8G8B8: return 32;
case D3DFMT_X8R8G8B8: return 32;
case D3DFMT_A2B10G10R10: return 32;
case D3DFMT_A8B8G8R8: return 32;
case D3DFMT_X8B8G8R8: return 32;
case D3DFMT_G16R16: return 32;
case D3DFMT_A2R10G10B10: return 32;
case D3DFMT_R8G8B8: return 24;
case D3DFMT_R5G6B5: return 16;
case D3DFMT_X1R5G5B5: return 16;
case D3DFMT_A1R5G5B5: return 16;
case D3DFMT_A4R4G4B4: return 16;
case D3DFMT_A8R3G3B2: return 16;
case D3DFMT_X4R4G4B4: return 16;
case D3DFMT_A8P8: return 8;
case D3DFMT_R3G3B2: return 8;
case D3DFMT_A8: return 8;
default: return 8;
}
}
#ifdef D3DX_SUPPORT
D3DXVECTOR3 WorldToScreen(D3DXMATRIX* WorldViewProjection, D3DVIEWPORT9* ViewPort, const D3DXVECTOR3 &in)
{
D3DXVECTOR3 out;
D3DXMatrixTranspose(WorldViewProjection, WorldViewProjection);
D3DXVec3TransformCoord(&out, &in, WorldViewProjection);
return D3DXVECTOR3((out.x + 1.0f) * ViewPort->Width * 0.5f + ViewPort->X, (1.0f - out.y) * ViewPort->Height * 0.5f + ViewPort->Y, out.z);
}
D3DXVECTOR3 WorldToScreen2(D3DVIEWPORT9* ViewPort, D3DXMATRIX* World, D3DXMATRIX* View, D3DXMATRIX* Projection, const D3DXVECTOR3 &in)
{
D3DXVECTOR3 out;
D3DXVec3Project(&out, &in, ViewPort, Projection, View, World);
return out;
}
#else
Vec3 WorldToScreen(Mat4* WorldViewProjection, D3DVIEWPORT9* ViewPort, const Vec3 &in)
{
Vec3 out = in.Transform(WorldViewProjection->Transpose());
return Vec3{(out.x + 1.0f) * ViewPort->Width * 0.5f + ViewPort->X, (1.0f - out.y) * ViewPort->Height * 0.5f + ViewPort->Y, out.z};
}
Vec3 WorldToScreen2(D3DVIEWPORT9* ViewPort, Mat4* World, Mat4* View, Mat4* Projection, const Vec3 &in)
{
return in.Project(ViewPort, World, View, Projection);
}
#endif // D3DX_SUPPORT
}
namespace GVMath
{
Vec3 GetEulerAngles(float (&mat)[16], bool rowmajor)
{
if (rowmajor)
{
float x = std::atan2(mat[6], mat[10]) * (180 / GVMath::PI);
float y = std::atan2(-mat[8], std::sqrt(std::pow(mat[0], 2) + std::pow(mat[1], 2))) * (180 / GVMath::PI);
float z = std::atan2(mat[1], mat[0]) * (180 / GVMath::PI);
return {x < 0 ? 360 - x : x, y < 0 ? 360 - y : y, z < 0 ? 360 - z : z};
}
else
{
float x = std::atan2(mat[9], mat[10]) * (180 / GVMath::PI);
float y = std::atan2(-mat[8], std::sqrt(std::pow(mat[0], 2) + std::pow(mat[4], 2))) * (180 / GVMath::PI);
float z = std::atan2(mat[4], mat[0]) * (180 / GVMath::PI);
return {x < 0 ? 360 - x : x, y < 0 ? 360 - y : y, z < 0 ? 360 - z : z};
}
}
Vec3 GetEulerAngles(float (&mat)[4][4], bool rowmajor)
{
if (rowmajor)
{
float x = std::atan2(mat[1][2], mat[2][2]) * (180 / GVMath::PI);
float y = std::atan2(-mat[0][2], std::sqrt(std::pow(mat[0][0], 2) + std::pow(mat[0][1], 2))) * (180 / GVMath::PI);
float z = std::atan2(mat[0][1], mat[0][0]) * (180 / GVMath::PI);
return {x < 0 ? 360 - x : x, y < 0 ? 360 - y : y, z < 0 ? 360 - z : z};
}
else
{
float x = std::atan2(mat[2][1], mat[2][2]) * (180 / GVMath::PI);
float y = std::atan2(-mat[2][0], std::sqrt(std::pow(mat[0][0], 2) + std::pow(mat[1][0], 2))) * (180 / GVMath::PI);
float z = std::atan2(mat[1][0], mat[0][0]) * (180 / GVMath::PI);
return {x < 0 ? 360 - x : x, y < 0 ? 360 - y : y, z < 0 ? 360 - z : z};
}
}
float Distance(float (&a)[2], float (&b)[2])
{
float x = a[0] - b[0];
float y = a[1] - b[1];
return sqrt((x * x) + (y * y));
}
float Distance(float (&a)[3], float (&b)[3])
{
float x = a[0] - b[0];
float y = a[1] - b[1];
float z = a[2] - b[2];
return sqrt((x * x) + (y * y) + (z * z));
}
Box2D BoundingBox(float* x, float* y, std::size_t size)
{
auto xtreme = std::minmax_element(x, x + size, [](const float lhs, const float rhs) {return lhs < rhs;});
auto ytreme = std::minmax_element(y, y + size, [](const float lhs, const float rhs) {return lhs < rhs;});
return {*xtreme.first, *ytreme.first, *xtreme.second, *ytreme.second};
}
Box3D BoundingBox(float* x, float* y, float* z, std::size_t size)
{
auto xtreme = std::minmax_element(x, x + size, [](const float lhs, const float rhs) {return lhs < rhs;});
auto ytreme = std::minmax_element(y, y + size, [](const float lhs, const float rhs) {return lhs < rhs;});
auto ztreme = std::minmax_element(z, z + size, [](const float lhs, const float rhs) {return lhs < rhs;});
return {*xtreme.first, *ytreme.first, *ztreme.first, *xtreme.second, *ytreme.second, *ztreme.second};
}
std::uint32_t ColourChecksum(const void* data, std::size_t width, std::size_t height)
{
return FullColourChecksum(data, width, height, height < 12 ? 0 : 12);
}
std::uint32_t FullColourChecksum(const void* data, std::size_t width, std::size_t height, std::size_t offset)
{
std::size_t k = 0;
std::uint32_t RSum = 0, GSum = 0, BSum = 0, ASum = 0;
const std::uint8_t* ptr = static_cast<const std::uint8_t*>(data);
for (std::size_t i = offset; i < height; ++i)
{
for (std::size_t j = 0; j < width; ++j, ++k)
{
RSum += *ptr++;
GSum += *ptr++;
BSum += *ptr++;
ASum += *ptr++;
}
}
return k != 0 ? RGB(RSum / k, GSum / k, BSum / k) : RGB(RSum, GSum, BSum);
}
std::uint32_t Adler32(const std::uint8_t* data, std::size_t size)
{
std::uint32_t a = 1, b = 0;
for (std::size_t i = 0; i < size; ++i)
{
a = (a + data[i]) % 0xFFF1;
b = (b + a) % 0xFFF1;
}
return (b << 0x10) | a;
}
std::uint32_t CRC32(const void* data, std::size_t size, std::uint32_t InitialValue)
{
static const std::uint32_t LookUpTable[256] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
};
std::uint32_t crc = ~InitialValue;
const std::uint8_t* ptr = static_cast<const std::uint8_t*>(data);
for(std::size_t i = 0; i < size; ++i)
{
crc = LookUpTable[(crc ^ *ptr++) & 0xFF] ^ (crc >> 8);
}
return ~crc;
}
}
//Get a vertex from the vertex buffer.
#ifdef D3DX_SUPPORT
D3DXVECTOR3 GetVertex(const std::uint8_t* vertices, std::int16_t index, std::uint16_t stride)
{
D3DXVECTOR3 res;
memcpy(&res.x, &vertices[index * stride], sizeof(float));
memcpy(&res.y, &vertices[index * stride + sizeof(float)], sizeof(float));
memcpy(&res.z, &vertices[index * stride + sizeof(float) * 2], sizeof(float));
return res;
}
#else
Vec3 GetVertex(const std::uint8_t* vertices, std::int16_t index, std::uint16_t stride)
{
Vec3 res;
memcpy(&res.x, &vertices[index * stride], sizeof(float));
memcpy(&res.y, &vertices[index * stride + sizeof(float)], sizeof(float));
memcpy(&res.z, &vertices[index * stride + sizeof(float) * 2], sizeof(float));
return res;
}
#endif // D3DX_SUPPORT
#ifdef D3DX_SUPPORT
void GetVertices(std::vector<D3DXVECTOR3> &verts, IDirect3DVertexBuffer9Proxy *VertexBuffer, IDirect3DIndexBuffer9Proxy *IndexBuffer, std::uint32_t BaseVertexIndex, std::uint32_t StartIndex, std::uint32_t PrimCount, std::uint32_t Stride)
{
const std::uint8_t* vertices = NULL;
const std::uint16_t* indices = NULL;
UINT EndIndex = StartIndex + (PrimCount * 3);
vertices = reinterpret_cast<const std::uint8_t*>(VertexBuffer->InternalBuffer());
indices = reinterpret_cast<const std::uint16_t*>(IndexBuffer->InternalBuffer()) + PrimCount * 3 * sizeof(std::uint16_t);
verts.resize(EndIndex - StartIndex);
for (UINT I = StartIndex, J = 0; I < EndIndex; ++I, ++J)
{
verts[J] = GetVertex(vertices, indices[I] + BaseVertexIndex, Stride);
}
}
#else
void GetVertices(std::vector<Vec3> &verts, IDirect3DVertexBuffer9Proxy *VertexBuffer, IDirect3DIndexBuffer9Proxy *IndexBuffer, std::uint32_t BaseVertexIndex, std::uint32_t StartIndex, std::uint32_t PrimCount, std::uint32_t Stride)
{
const std::uint8_t* vertices = NULL;
const std::uint16_t* indices = NULL;
UINT EndIndex = StartIndex + (PrimCount * 3);
vertices = reinterpret_cast<const std::uint8_t*>(VertexBuffer->InternalBuffer());
indices = reinterpret_cast<const std::uint16_t*>(IndexBuffer->InternalBuffer()) + PrimCount * 3 * sizeof(std::uint16_t);
verts.resize(EndIndex - StartIndex);
for (UINT I = StartIndex, J = 0; I < EndIndex; ++I, ++J)
{
verts[J] = GetVertex(vertices, indices[I] + BaseVertexIndex, Stride);
}
}
#endif // D3DX_SUPPORT
//Create memory map for Simba to send and retrieve information to/from. One for the Image buffer if needed (for browsers) and one for hooks (split into four parts.. Fonts, Textures, Models, Other). All info is stored directly in the map rather than copied. That allows simba to access exactly what the plugin sees and not a copy of it. As soon as the plugin gets something, simba can see it without having to ask and wait every frame. Note to self: OpenGL plugin should really do this!
void IDirect3DDevice9ProxyHook::HandleMemory(bool AllocateImage)
{
if (!CommMap)
{
CommMap.reset(new Communication(RequestEventName, ResponseEventName, MemName, HookSize, std::ios::in | std::ios::out));
}
if (AllocateImage)
{
static std::uint32_t BestSize = 0;
static std::uint32_t Width = 0, Height = 0, Size = 0;
if (!ImgMap)
{
RECT rect = {0};
D3DDEVICE_CREATION_PARAMETERS params;
IDirect3DDevice9Proxy::GetCreationParameters(¶ms);
GetWindowRect(params.hFocusWindow, &rect);
Width = rect.right - rect.left;
Height = rect.bottom - rect.top;
Size = Width * Height * 4;
BestSize = TotalImageSize > Size ? TotalImageSize : Size <= 0 ? TotalImageSize : Size;
char buffer[256] = {0};
sprintf(buffer, "%s%lu", MemName, GetCurrentProcessId());
ImgMap.reset(new MemoryMap(buffer, BestSize, std::ios::in | std::ios::out));
if (ImgMap->open())
{
ImgMap->map();
}
}
}
}
void IDirect3DDevice9ProxyHook::HandleCommunication()
{
if (CommMap)
{
CommMap->ProcessRequests(); //process special requests from Simba controller.
}
}
//Draw texture ID's on the screen. Draw model ID's on the screen.
void IDirect3DDevice9ProxyHook::HandleDebugDrawing()
{
if (font)
{
for (auto&& tex : textures)
{
font->Draw(tex.X, tex.Y, D3DCOLOR_XRGB(0, 0xFF, 0), "%", tex.ID);
}
for (auto&& mod : models)
{
font->Draw(mod.X, mod.Y, D3DCOLOR_XRGB(0xFF, 0, 0), "%", mod.ID);
}
}
textures.clear();
models.clear();
}
IDirect3DDevice9ProxyHook::IDirect3DDevice9ProxyHo ok(IDirect3DDevice9* pOriginal) : IDirect3DDevice9Proxy(pOriginal) {}
IDirect3DDevice9ProxyHook::~IDirect3DDevice9ProxyH ook() {}
ULONG IDirect3DDevice9ProxyHook::AddRef()
{
++references;
return IDirect3DDevice9ProxyHook::AddRef();
}
ULONG IDirect3DDevice9ProxyHook::Release()
{
if (--references == 0)
{
//destroy resources.
font.reset(nullptr);
pTexture = nullptr;
pIndexBuffer = nullptr;
pVertexBuffer = nullptr;
}
return IDirect3DDevice9ProxyHook::Release();
}
//Override rendering
HRESULT IDirect3DDevice9ProxyHook::DrawPrimitive(D3DPRIMIT IVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount)
{
if (pTexture)
{
//ID of the compass and animated textures in here sometimes..
//D3DXVECTOR3 vertex = WorldToScreen(pOriginal);
//font->Draw(vertex.x, vertex.y, "%", curr->ID);
}
return IDirect3DDevice9Proxy::DrawPrimitive(PrimitiveType , StartVertex, PrimitiveCount);
}
HRESULT IDirect3DDevice9ProxyHook::DrawIndexedPrimitive(D3 DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{
if (pTexture && pIndexBuffer && pVertexBuffer && (primCount == 2 || NumVertices == 4))
{
if (PrimitiveType == D3DPT_TRIANGLELIST)
{
DWORD fvf = 0;
IDirect3DDevice9Proxy::GetFVF(&fvf); //OPTIMIZATION! Get FVF instead of vertex buffer!
#ifdef D3DX_SUPPORT
std::vector<D3DXVECTOR3> verts;
GetVertices(verts, pVertexBuffer, pIndexBuffer, BaseVertexIndex, startIndex, primCount, DXMath::CalculateStride(fvf));
#else
std::vector<Vec3> verts; //BAD! Should just store it in the map directly instead of copy :(
GetVertices(verts, pVertexBuffer, pIndexBuffer, BaseVertexIndex, startIndex, primCount, DXMath::CalculateStride(fvf));
#endif // D3DX_SUPPORT
//Project texture vertices to the screen.. Draw ID at the center of the texture..
if (verts.size())
{
#ifdef D3DX_SUPPORT
D3DXVECTOR3 in = {(verts[0].x + verts[4].x) / 2.0f, (verts[0].y + verts[4].y) / 2.0f, 0};
D3DXVECTOR3 out = DXMath::WorldToScreen2(&ViewPort, &World, &View, &Projection, in);
#else
Vec3 in = {(verts[0].x + verts[4].x) / 2.0f, (verts[0].y + verts[4].y) / 2.0f, 0};
Vec3 out = DXMath::WorldToScreen2(&ViewPort, &World, &View, &Projection, in);
#endif // D3DX_SUPPORT
textures.emplace_back(TextureInfo{ //Bad.. Copy for testing.. TODO: Move it to the memory map instead.
pTexture->GetID(),
pTexture->GetFID(),
static_cast<std::uint32_t>(out.x),
static_cast<std::uint32_t>(out.y),
{verts[0].x, verts[0].y, verts[0].z,
verts[1].x, verts[1].y, verts[1].z,
verts[2].x, verts[2].y, verts[2].z,
verts[3].x, verts[3].y, verts[3].z,
verts[4].x, verts[4].y, verts[4].z,
verts[5].x, verts[5].y, verts[5].z}
});
}
}
}
else if (pVertexBuffer)
{
//Bad ID generation. Should use the vertex buffer hash.
//Get vertex shader and project Model BASE to the screen..
//unsigned int ID = NumVertices | (primCount << 16);
/*IDirect3DDevice9Proxy::GetVertexShaderConstantF(0 , reinterpret_cast<float*>(&WorldViewProjection), 4);
#ifdef D3DX_SUPPORT
D3DXVECTOR3 out = DXMath::WorldToScreen(&WorldViewProjection, &ViewPort);
#else
Vec3 out = {0, 0, 0};//DXMath::WorldToScreen(&WorldViewProjection, &ViewPort);
#endif // D3DX_SUPPORT
//BAD. Copy vertices. TODO: Move to memory map instead.
std::vector<float> vertices = std::move(pVertexBuffer->GetVertices(pIndexBuffer, BaseVertexIndex, startIndex, primCount));
models.emplace_back(ModelInfo{
GVMath::CRC32(&vertices[0], vertices.size() * sizeof(float)),
static_cast<std::uint32_t>(out.x),
static_cast<std::uint32_t>(out.y),
NumVertices,
primCount,
PrimitiveType,
pIndexBuffer->GetID(),
pIndexBuffer->InternalBufferSize(),
{out.x, out.y, out.z},
{WorldViewProjection[0][0], WorldViewProjection[0][1], WorldViewProjection[0][2], WorldViewProjection[0][3],
WorldViewProjection[1][0], WorldViewProjection[1][1], WorldViewProjection[1][2], WorldViewProjection[1][3],
WorldViewProjection[2][0], WorldViewProjection[2][1], WorldViewProjection[2][2], WorldViewProjection[2][3],
WorldViewProjection[3][0], WorldViewProjection[3][1], WorldViewProjection[3][2], WorldViewProjection[3][3]}
});*/
}
return IDirect3DDevice9Proxy::DrawIndexedPrimitive(Primit iveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
HRESULT IDirect3DDevice9ProxyHook::BeginScene()
{
HRESULT res = IDirect3DDevice9Proxy::BeginScene();
HandleMemory(false);
if (!font)
{
font.reset(new Font(this->Original(), "Arial", 8));
}
//Get the matrices only once! They never ever change after the scene/game has loaded! NOTE: Might be better to call this in a static context block (IE: std::call_once).
#ifdef D3DX_SUPPORT
IDirect3DDevice9Proxy::GetViewport(&ViewPort);
IDirect3DDevice9Proxy::GetTransform(D3DTS_VIEW, &View);
IDirect3DDevice9Proxy::GetTransform(D3DTS_PROJECTI ON, &Projection);
IDirect3DDevice9Proxy::GetTransform(D3DTS_WORLD, &World);
#else
IDirect3DDevice9Proxy::GetViewport(&ViewPort);
IDirect3DDevice9Proxy::GetTransform(D3DTS_VIEW, reinterpret_cast<D3DMATRIX*>(&View[0][0]));
IDirect3DDevice9Proxy::GetTransform(D3DTS_PROJECTI ON, reinterpret_cast<D3DMATRIX*>(&Projection[0][0]));
IDirect3DDevice9Proxy::GetTransform(D3DTS_WORLD, reinterpret_cast<D3DMATRIX*>(&World[0][0]));
#endif // D3DX_SUPPORT
return res;
}
HRESULT IDirect3DDevice9ProxyHook::EndScene()
{
//If the SMART plugin is a valid version.. Capture the back buffer and feed it to SMART. Draw SMART's debug and then the mouse on top.. but only if SMART is NOT minimized!
if (SMARTIsValid())
{
/*static int Width = 0, Height = 0;
static D3DFORMAT Format = D3DFMT_UNKNOWN;
SMARTCaptureBackBuffer(IDirect3DDevice9Proxy::Orig inal(), Width, Height, Format);
if (!SMARTIsMinimised(IDirect3DDevice9Proxy::Original ()))
{
StateBlock block = {IDirect3DDevice9Proxy::Original()};
IDirect3DDevice9Proxy::SetRenderState(D3DRS_LIGHTI NG, FALSE);
IDirect3DDevice9Proxy::SetRenderState(D3DRS_FOGENA BLE, FALSE);
IDirect3DDevice9Proxy::SetRenderState(D3DRS_ZENABL E, D3DZB_FALSE);
IDirect3DDevice9Proxy::SetRenderState(D3DRS_CULLMO DE, D3DCULL_NONE);
IDirect3DDevice9Proxy::SetRenderState(D3DRS_ALPHAB LENDENABLE, FALSE);
IDirect3DDevice9Proxy::SetRenderState(D3DRS_BLENDO P, D3DBLENDOP_ADD);
IDirect3DDevice9Proxy::SetRenderState(D3DRS_SRCBLE ND, D3DBLEND_SRCALPHA);
IDirect3DDevice9Proxy::SetRenderState(D3DRS_DESTBL END, D3DBLEND_INVSRCALPHA);
if (SMARTIsDebugEnabled())
{
SMARTDrawBackBuffer(IDirect3DDevice9Proxy::Origina l());
}
int X = -1, Y = -1;
if (SMARTGetMousePosition(X, Y))
{
IDirect3DDevice9Proxy::SetTexture(0, nullptr);
IDirect3DDevice9Proxy::SetPixelShader(nullptr);
IDirect3DDevice9Proxy::SetVertexShader(nullptr);
Graphics g = {IDirect3DDevice9Proxy::Original()};
g.DrawCircle(X, Y, 2.5f, D3DCOLOR_XRGB(0xFF, 0, 0));
}
}*/
}
else
{
HandleMemory(true);
}
//Process Simba special requests.. There shouldn't really be any because everything is stored in a shared segment immediately.
//HandleCommunication();
//HandleDebugDrawing(); //for browsers and things other than SMART.
return IDirect3DDevice9Proxy::EndScene();
}
HRESULT IDirect3DDevice9ProxyHook::Reset(D3DPRESENT_PARAME TERS* pPresentationParameters)
{
if (font)
font->OnLostDevice();
HRESULT res = IDirect3DDevice9Proxy::Reset(pPresentationParamete rs);
if (font)
font->OnResetDevice();
return res;
}
//Override creations! Hell Yes! This allows us to add cookies to the model, backbuffer, textures, etc.. :) Such as ID's, positions, etc.. so they never have to be calculated again unless the model updates (via lock/unlock)!
HRESULT IDirect3DDevice9ProxyHook::CreateAdditionalSwapCha in(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain)
{
HRESULT res = IDirect3DDevice9Proxy::CreateAdditionalSwapChain(p PresentationParameters, pSwapChain);
if (res == D3D_OK)
{
*pSwapChain = new IDirect3DSwapChain9Proxy(*pSwapChain);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle)
{
HRESULT res = IDirect3DDevice9Proxy::CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle);
if (res == D3D_OK)
{
*ppTexture = new IDirect3DTexture9Proxy(*ppTexture, Width, Height, Format);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle)
{
HRESULT res = IDirect3DDevice9Proxy::CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle);
if (res == D3D_OK)
{
*ppVertexBuffer = new IDirect3DVertexBuffer9Proxy(*ppVertexBuffer, Length, FVF);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle)
{
HRESULT res = IDirect3DDevice9Proxy::CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle);
if (res == D3D_OK)
{
*ppIndexBuffer = new IDirect3DIndexBuffer9Proxy(*ppIndexBuffer, Length, Format);
}
return res;
}
//Override setters
HRESULT IDirect3DDevice9ProxyHook::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture)
{
this->pTexture = nullptr;
if (pTexture && pTexture->GetType() == D3DRTYPE_TEXTURE)
{
this->pTexture = static_cast<IDirect3DTexture9Proxy*>(pTexture);
return IDirect3DDevice9Proxy::SetTexture(Stage, static_cast<IDirect3DTexture9Proxy*>(pTexture)->Original());
}
return IDirect3DDevice9Proxy::SetTexture(Stage, pTexture);
}
HRESULT IDirect3DDevice9ProxyHook::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride)
{
this->pVertexBuffer = nullptr;
if (pStreamData && pStreamData->GetType() == D3DRTYPE_VERTEXBUFFER)
{
this->pVertexBuffer = static_cast<IDirect3DVertexBuffer9Proxy*>(pStreamData);
return IDirect3DDevice9Proxy::SetStreamSource(StreamNumbe r, static_cast<IDirect3DVertexBuffer9Proxy*>(pStreamData)->Original(), OffsetInBytes, Stride);
}
return IDirect3DDevice9Proxy::SetStreamSource(StreamNumbe r, pStreamData, OffsetInBytes, Stride);
}
HRESULT IDirect3DDevice9ProxyHook::SetIndices(IDirect3DInd exBuffer9* pIndexData)
{
this->pIndexBuffer = nullptr;
if (pIndexData && pIndexData->GetType() == D3DRTYPE_INDEXBUFFER)
{
this->pIndexBuffer = static_cast<IDirect3DIndexBuffer9Proxy*>(pIndexData);
return IDirect3DDevice9Proxy::SetIndices(static_cast<IDirect3DIndexBuffer9Proxy*>(pIndexData)->Original());
}
return IDirect3DDevice9Proxy::SetIndices(pIndexData);
}
//Override consumers
HRESULT IDirect3DDevice9ProxyHook::GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain)
{
HRESULT res = IDirect3DDevice9Proxy::GetSwapChain(iSwapChain, pSwapChain);
if (res == D3D_OK)
{
*pSwapChain = new IDirect3DSwapChain9Proxy(*pSwapChain);
}
return res;
}
HRESULT IDirect3DDevice9ProxyHook::ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags)
{
return IDirect3DDevice9Proxy::ProcessVertices(SrcStartInd ex, DestIndex, VertexCount, static_cast<IDirect3DVertexBuffer9Proxy*>(pDestBuffer)->Original(), pVertexDecl, Flags);
}
SMART plugin interface overhaul:
#include "Plugin.hxx"
const constexpr int DXButtonIDs[2] = {100, 101};
const constexpr char* DXButtonTexts[2] = {"Disable DirectX_Enable DirectX", "Enable DXDebug_Disable DXDebug"};
SMARTInfo* SmartGlobal = nullptr;
bool SMARTDebugEnabled = false;
bool SMARTCaptureEnabled = true;
template<typename T>
void SMARTSafeRelease(T* &Ptr)
{
if (Ptr)
{
Ptr->Release();
Ptr = nullptr;
}
}
void SMARTButtonPressed(int ID, bool State)
{
switch(ID)
{
case DXButtonIDs[0]:
SmartGlobal->setCapture(!State);
SMARTCaptureEnabled = State;
break;
case DXButtonIDs[1]:
SMARTDebugEnabled = !State;
break;
}
}
void SMARTPluginInit(SMARTInfo* ptr, bool* ReplaceButtons, int* ButtonCount, const char* const** ButtonText, const int** ButtonIDs, _SMARTButtonPressed* ButtonCallback)
{
SmartGlobal = ptr;
if (ptr)
{
*ReplaceButtons = true;
*ButtonCount = 2;
*ButtonIDs = DXButtonIDs;
*ButtonText = DXButtonTexts;
*ButtonCallback = &SMARTButtonPressed;
}
}
bool SMARTIsValid()
{
return SmartGlobal && SmartGlobal->version;
}
bool SMARTIsCaptureEnabled()
{
return SMARTCaptureEnabled;
}
bool SMARTIsDebugEnabled()
{
return SMARTDebugEnabled;
}
bool SMARTGetMousePosition(int &X, int &Y)
{
SmartGlobal->getMousePos(X, Y);
return X > -1 && Y > -1;
}
bool SMARTIsMinimised(IDirect3DDevice9 *device)
{
IDirect3DSurface9* RenderTarget = nullptr;
HRESULT result = device->GetRenderTarget(0, &RenderTarget);
if (result == D3D_OK)
{
HDC DC = nullptr;
RenderTarget->GetDC(&DC);
bool Minimised = IsIconic(WindowFromDC(DC));
RenderTarget->ReleaseDC(DC);
SMARTSafeRelease(RenderTarget);
return Minimised;
}
return false;
}
void SMARTNormaliseAlphaChannel() //needed because of Simba's non-support of 32-bit proper alpha channels!
{
std::uint8_t* Ptr = reinterpret_cast<std::uint8_t*>(SmartGlobal->dbg);
for (int I = 0; I < SmartGlobal->height; ++I)
{
for (int J = 0; J < SmartGlobal->width; ++J)
{
std::uint8_t B = *(Ptr++);
std::uint8_t G = *(Ptr++);
std::uint8_t R = *(Ptr++);
*(Ptr++) = (B == 0 && G == 0 && R == 0) ? 0 : 0xFF;
}
}
}
void SMARTCaptureBackBuffer(IDirect3DDevice9* device, int &Width, int &Height, D3DFORMAT Format)
{
IDirect3DSurface9* RenderTarget = nullptr;
IDirect3DSurface9* DestTarget = nullptr;
HRESULT result = device->GetRenderTarget(0, &RenderTarget);
if (result == D3D_OK)
{
if (Width == 0 || Height == 0 || Format == D3DFMT_UNKNOWN)
{
D3DSURFACE_DESC descriptor = {};
RenderTarget->GetDesc(&descriptor);
Width = descriptor.Width;
Height = descriptor.Height;
Format = descriptor.Format;
}
result = device->CreateOffscreenPlainSurface(Width, Height, Format, D3DPOOL_SYSTEMMEM, &DestTarget, nullptr);
result = device->GetRenderTargetData(RenderTarget, DestTarget);
D3DLOCKED_RECT rect;
DestTarget->LockRect(&rect, 0, D3DLOCK_READONLY);
memcpy(SmartGlobal->img, rect.pBits, Width * Height * 4);
DestTarget->UnlockRect();
}
SMARTSafeRelease(RenderTarget);
SMARTSafeRelease(DestTarget);
}
void SMARTDrawBackBuffer(IDirect3DDevice9* device)
{
SMARTNormaliseAlphaChannel();
Texture texture = {device, SmartGlobal->width, SmartGlobal->height, D3DFMT_A8R8G8B8};
memcpy(texture.Lock(), SmartGlobal->dbg, SmartGlobal->width * SmartGlobal->height * 4);
texture.Unlock();
texture.Draw(0, 0, SmartGlobal->width, SmartGlobal->height);
}
typedef struct
{
char letter;
std::uint32_t ID;
std::uint32_t FID;
std::uint32_t X, Y;
float vertices[18];
} FontInfo;
typedef struct
{
std::uint32_t ID;
std::uint32_t FID;
std::uint32_t X, Y;
float vertices[18];
} TextureInfo;
typedef struct
{
std::uint32_t ID;
std::uint32_t X, Y;
std::uint32_t VertexCount;
std::uint32_t PrimitiveCount;
std::uint32_t PrimitiveType;
std::uint32_t IID;
std::uint32_t IICount;
float RealBase[3];
float Matrix[16];
SharedMemoryVector<float> vertices;
} ModelInfo;
Lucidity
07-09-2015, 01:14 AM
but in the long term won't NXT cancel out dx?
Brandon
07-09-2015, 01:26 AM
but in the long term won't NXT cancel out dx?
No.. It'll just shrink the size of some communities. Only the ones with versatile programmers will survive. Besides, on Windows you have 3 options: Safemode/software, OpenGL, Direct-X. Jagex already stated they plan on using Direct-X 12 and the SDK documentation is already public.. so..
Clarity
07-09-2015, 01:52 AM
No.. It'll just shrink the size of some communities. Only the ones with versatile programmers will survive. Besides, on Windows you have 3 options: Safemode/software, OpenGL, Direct-X. Jagex already stated they plan on using Direct-X 12 and the SDK documentation is already public.. so..
Where did they say that?
Forty Two
07-09-2015, 02:03 AM
At launch though? I was told by a certain 2 people (who are currently viewing this thread :P) that DirectX was being dropped. It is true that DirectX is usually easier to develop for, because it handles most of the device initialisation and such for you. But I was hoping we Jagex would promote OpenGL technology so we can get more games that run on Linux distributions!! If they plan on doing both however, it would be nice to have DirectX for casual botters and then lightweight OpenGL for goldfarmers. Image the potential for headless linux servers running several bots.
As for your generous post of source material thanks! I have had a sudden workload increase for this month, but I would like to fork your DirectX and OpenGL on Github and help with development. It would be so cool if we could push out a bunch of DirectX and OpenGL methods in preparation for the NXT client. I wonder if it would be more viable to dispose of simba (release of NXT make everything obsolete anyway) and build a new bot client which simply hooks the NXT client directly and reads process memory. That would be a fun project.
Also it would be slightly more efficient to use a single memcpy rather than 3 in GetVertex. The floats are all contiguous (I assume). In fact you could probably do:
memcpy(&res, &vertices[index * stride], sizeof(float) * 3); //
Maybe the compiler already optimises it that way, I dono.
KeepBotting
07-09-2015, 02:16 AM
At launch though? I was told by a certain 2 people (who are currently viewing this thread :P) that DirectX was being dropped. It is true that DirectX is usually easier to develop for, because it handles most of the device initialisation and such for you. But I was hoping we Jagex would promote OpenGL technology so we can get more games that run on Linux distributions!! If they plan on doing both however, it would be nice to have DirectX for casual botters and then lightweight OpenGL for goldfarmers. Image the potential for headless linux servers running several bots.
As for your generous post of source material thanks! I have had a sudden workload increase for this month, but I would like to fork your DirectX and OpenGL on Github and help with development. It would be so cool if we could push out a bunch of DirectX and OpenGL methods in preparation for the NXT client. I wonder if it would be more viable to dispose of simba (release of NXT make everything obsolete anyway) and build a new bot client which simply hooks the NXT client directly and reads process memory. That would be a fun project.
Also it would be slightly more efficient to use a single memcpy rather than 3 in GetVertex. The floats are all contiguous (I assume). In fact you could probably do:
memcpy(&res, &vertices[index * stride], sizeof(float) * 3); //
Maybe the compiler already optimises it that way, I dono.
I don't think Simba will ever be disposed of -- it'll never become completely obsolete either. As long as the game has colors, Simba will be a viable method for autoing. SRL will break, and we may even have to dump SMART, but Simba will still be there.
The next version of SRL has to be 6.9, though. Can't skip that.
Brandon
07-09-2015, 02:17 AM
Where did they say that?
I had book marked the QFC: 198-199-113-65596566 but it doesn't seem to exist :S IIRC, there was a post by a mod with something to the effect of "We plan to support OpenGL for multiple platforms and we're looking into/keeping an eye on Direct-X 12".
Clarity
07-09-2015, 02:26 AM
I had book marked the QFC: 198-199-113-65596566 but it doesn't seem to exist :S IIRC, there was a post by a mod with something to the effect of "We plan to support OpenGL for multiple platforms and we're looking into/keeping an eye on Direct-X 12".
Alright, well I suppose we'll never know for sure until release, or more development blog posts!
Reason I asked, was that I last heard it was WebGL with DX getting dropped. Perhaps your bookmarked post was more up to date.
Forty Two
07-09-2015, 02:27 AM
All I have seen on the subject. http://runescape.wikia.com/wiki/Update:Blog_-_New_Runescape_Client
Look at those screenshots at the bottom of the page!
Maybe we should ask a J-Mod, "Hey I'm planning on hacking your new C client to pieces, are you planning on using DirectX 12?"
Forty Two
07-09-2015, 02:30 AM
Alright, well I suppose we'll never know for sure until release, or more development blog posts!
Reason I asked, was that I last heard it was WebGL with DX getting dropped. Perhaps your bookmarked post was more up to date.
Java support for all browsers is being dropped soon, "WebGL (Web Graphics Library) is a JavaScript API for rendering interactive 3D computer graphics and 2D graphics within any compatible web browser without the use of plug-ins." - Google
So I doubt that is going to happen. But hey! C is much easier to reverse engineer, we just ahve to be careful about anti-cheat.
The Mayor
07-09-2015, 06:11 AM
Thanks Brandon for the update on this project! When you are ub3r smart like you are then people will always rely on you for stuff :p
Forty Two
07-10-2015, 03:26 AM
You got all the matrices from device->GetTransform... I swear that was the first thing I tried :S
I also just realised I have been hooking GetStreamSource and locking the vertex buffer in every draw call. Didn't even think to just grab it once in SetStreamSource. My XY projections are still way off though.
I see you have a CRC hashing function, do you plan on using texture checksums or vertex counts? I think the checksums change when the texture quality and such changes.
You base code looks well optimized already, make sure to put it on GitHub when you are free so I can fork it.
My code is currently a mess of kludged functions, just a proof of concept really. :)
On a side note.
When NXT releases can we expect Simba to be rewritten to read process memory directly? And while we are at it, we should rewrite Simba in C. Then we could use Windows API to send input directly to the client window, and hook game functions all day long.
bonsai
08-02-2015, 11:32 PM
Brandon;
I was curious if you had a newer codebase to share? I've been trying to get a better understanding of all this. I keep falling down ratholes but it's starting to make sense.
As far as using it: I downloaded the latest github (v0.6?) and got it compiled under VS2015. I used the project in the d3d9-visual folder.
I can play in smart/directx like normal when using these DLLs. I could not get it to pass DXISetup() though. I think you said to expect it not to work under smart.
I got results with the runescape client. At first I got the MAP-ID message box. The RS window was black except the blah text at the bottom. The script ran but the debug was all black.
Then I commented out the MessageBoxA call. Much better. The debug was off but it tried:
http://puu.sh/jn4Wu/b8d08e7e4d.jpg
Full size (http://puu.sh/jn2cw/9536753717.jpg)
I was unable to get it to work with firefox. It never popped up the dialog so I'm guessing it's not getting loaded at all.
I used this script after targeting the window and entering the handle that prints:
{$loadlib DXI}
Function PtrToBmp(Width, Height: Integer; Ptr: Pointer): Integer;
var
Bmp: TMufasaBitmap;
Begin
Bmp.Init(Client.GetMBitmaps);
Bmp.SetPersistentMemory(Uint32(Ptr), Width, Height);
Bmp.SetTransparentColor(0);
Result := Bmp.GetIndex();
End;
Procedure DrawBox(Bmp: Integer; Box: TBox; Fill: Boolean = False; Colour: TColor = $FF);
var
TPA: Array Of TPoint;
TM: TMufasaBitmap;
Begin
TM := GetMufasaBitmap(Bmp);
If (Fill) then
TM.Rectangle(Box, Colour)
Else
Begin
TPA := EdgeFromBox(Box);
TM.DrawTPA(TPA, Colour);
End;
End;
Procedure ClearBox(Bmp: Integer; Box: TBox);
Begin
DrawBox(Bmp, Box, True, $0);
End;
Procedure DebugBitmap(Bmp: Integer);
var
W, H: Integer;
Begin
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
Bmp: Integer;
W, H: Integer;
begin
GetClientDimensions(W, H); //this line requires that you drag the crosshairs on the window.
if (DXISetup(5506142)) then //change the this value to the PID..
begin
writeln('DXI setup succeeded');
Bmp := PtrToBmp(W, H, DXIImagePointer());
DebugBitmap(Bmp);
FreeBitmap(Bmp);
Bmp := PtrToBmp(W, H, DXIDebugPointer());
ClearBox(Bmp, IntToBox(0, 0, W - 1, H - 1));
DrawBox(Bmp, IntToBox(0, 0, 100, 100));
FreeBitmap(Bmp);
end else
writeln('Failed to setup DXI.');
end.
bonsai; if I had to guess you dont have the alpha values included in the bitmap; 32bit rather than 24bit. Explains the massive black section taking up the screen at the bottom. Either that or you have the wrong width and height set. idno the format of the ptr, but try and debug the values you have in the pointer, also try debug the client sizes.
Forty Two; Direct-x is a bitch to debug. OpenGL is easier.
Brandon
08-03-2015, 11:54 PM
bonsai; if I had to guess you dont have the alpha values included in the bitmap; 32bit rather than 24bit. Explains the massive black section taking up the screen at the bottom. Either that or you have the wrong width and height set. idno the format of the ptr, but try and debug the values you have in the pointer, also try debug the client sizes.
Forty Two; Direct-x is a bitch to debug. OpenGL is easier.
100% it's the wrong size he's using. bonsai; are you trying to run it in the browser? The current plugin doesn't do that. I had originally uploaded the code for that but I have no idea where it is :S
I'm pretty sure I uploaded it somewhere to compiled with VS2012 and Codeblocks. If I can't find it, I'll just rewrite the part that allows it to work in the browser. The thing is, you don't really need Direct-X plugin for the browser because the cross-hairs seem to work fine?
Anyway, let me know what you need added or debugged. IE: Steps to reproduce the problem you are having. I've got more free-time this week :)
bonsai
08-04-2015, 01:13 AM
100% it's the wrong size he's using. bonsai; are you trying to run it in the browser? The current plugin doesn't do that. I had originally uploaded the code for that but I have no idea where it is :S
I'm pretty sure I uploaded it somewhere to compiled with VS2012 and Codeblocks. If I can't find it, I'll just rewrite the part that allows it to work in the browser. The thing is, you don't really need Direct-X plugin for the browser because the cross-hairs seem to work fine?
Anyway, let me know what you need added or debugged. IE: Steps to reproduce the problem you are having. I've got more free-time this week :)
My end goal would be to be able to get at the textures, fonts, etc, like in opengl. But for now I'm just trying to understand it all.
I was trying to build my own dll and call the DXIxxx functions that are exported.
I downloaded the newest github and built the visual studio projects. I put d3d9.dll in the runescape client folder and both dlls in the simba plugins folder. I started the rs client and got a popup when it created shared memory. The screen didn't load up after I clicked it.
I commented out the message box and redid. Then the client painted. I used your test script in simba, dragged the crosshairs and entered the window handle. That's where the debug picture came from. The W/H are from simba.
The RS client ends up hung.
Brandon
08-04-2015, 02:32 AM
My end goal would be to be able to get at the textures, fonts, etc, like in opengl. But for now I'm just trying to understand it all.
I was trying to build my own dll and call the DXIxxx functions that are exported.
I downloaded the newest github and built the visual studio projects. I put d3d9.dll in the runescape client folder and both dlls in the simba plugins folder. I started the rs client and got a popup when it created shared memory. The screen didn't load up after I clicked it.
I commented out the message box and redid. Then the client painted. I used your test script in simba, dragged the crosshairs and entered the window handle. That's where the debug picture came from. The W/H are from simba.
The RS client ends up hung.
EDIT: I updated the Visual Studio source to include the below fixes (didn't update the VS .dll modules though..).
I see. It's not actually "hung". It's a black screen because the debug is drawing badly due to Simba's 32-bit alpha channel being completely borked + I had not updated the Visual Studio source to handle it at the time.
Change IDirect3DDevice9Proxy EndScene implementation (and you can remove the popups from the SharedMemory file I forgot to remove it for debugging):
HRESULT Direct3DDevice9Proxy::EndScene()
{
bool isMinimised = false;
if (SmartGlobal && SmartGlobal->version)
{
dxReadPixels(ptr_Direct3DDevice9, SmartGlobal->img, isMinimised, SmartGlobal->width, SmartGlobal->height);
IDirect3DStateBlock9* block;
ptr_Direct3DDevice9->CreateStateBlock(D3DSBT_ALL, &block);
block->Capture();
ptr_Direct3DDevice9->SetRenderState(D3DRS_LIGHTING, FALSE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_FOGENABLE, FALSE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); //DISABLED 2014-02-28..
ptr_Direct3DDevice9->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
ptr_Direct3DDevice9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
ptr_Direct3DDevice9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
if (SmartDebugEnabled && !isMinimised)
{
BltSmartBuffer(ptr_Direct3DDevice9);
}
int X = -1, Y = -1;
SmartGlobal->getMousePos(X, Y);
if (X > -1 && Y > -1)
{
//ptr_Direct3DDevice9->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
ptr_Direct3DDevice9->SetTexture(0, nullptr);
ptr_Direct3DDevice9->SetPixelShader(nullptr);
ptr_Direct3DDevice9->SetVertexShader(nullptr);
DrawCircle(ptr_Direct3DDevice9, X, Y, 2.5f);
}
block->Apply();
block->Release();
}
else
{
if (!SharedImageData || !SharedImageData->GetDataPointer())
{
CreateSharedMemory(GetCurrentProcessId()) || OpenSharedMemory(GetCurrentProcessId());
}
int Width = 0, Height = 0;
void* ImgPtr = SharedImageData->GetDataPointer();
dxReadPixels(ptr_Direct3DDevice9, ImgPtr, isMinimised, Width, Height);
if (!isMinimised)
{
IDirect3DStateBlock9* block;
ptr_Direct3DDevice9->CreateStateBlock(D3DSBT_ALL, &block);
block->Capture();
ptr_Direct3DDevice9->SetRenderState(D3DRS_LIGHTING, FALSE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_FOGENABLE, FALSE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
ptr_Direct3DDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); //DISABLED 2014-02-28..
ptr_Direct3DDevice9->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
ptr_Direct3DDevice9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
ptr_Direct3DDevice9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
void* DbgPtr = reinterpret_cast<std::uint8_t*>(SharedImageData->GetDataPointer()) + SharedImageSize;
BltMappedBuffer(ptr_Direct3DDevice9, DbgPtr, Width, Height);
block->Apply();
block->Release();
}
}
return ptr_Direct3DDevice9->EndScene();
}
Change DXI's dllmain.cpp (so that it maps both the debug and the game image instead of just one -- TotalImageSize instead of SharedImageSize):
bool OpenSharedMemory(DWORD ProcessID, unsigned int Width, unsigned int Height)
{
if (Width == 0 || Height == 0)
{
GetDesktopResolution(Width, Height);
}
SharedImageData.reset(new SharedMemory(SharedImageName + std::to_string(ProcessID)));
return SharedImageData->OpenMemoryMap(Width || Height == 0 ? TotalImageSize : Width * Height * 4 * 2);
}
Then you can run the below modified script for the latest Simba (Just drag the cross-hairs on the RSWindow and hit play):
{$loadlib DXI}
Function PtrToBmp(Width, Height: Integer; Ptr: Pointer): Integer;
var
Bmp: TMufasaBitmap;
Begin
Bmp.Init(Client.GetMBitmaps);
Bmp.SetPersistentMemory(PtrUInt(Ptr), Width, Height);
Bmp.SetTransparentColor(0);
Result := Bmp.GetIndex();
End;
Procedure DrawBox(Bmp: Integer; Box: TBox; Fill: Boolean = False; Colour: TColor = $FF);
var
TPA: Array Of TPoint;
TM: TMufasaBitmap;
Begin
TM := GetMufasaBitmap(Bmp);
If (Fill) then
TM.Rectangle(Box, Colour)
Else
Begin
TPA := EdgeFromBox(Box);
TM.DrawTPA(TPA, Colour);
End;
End;
Procedure ClearBox(Bmp: Integer; Box: TBox);
Begin
DrawBox(Bmp, Box, True, $0);
End;
Procedure DebugBitmap(Bmp: Integer);
var
W, H: Integer;
Begin
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
Bmp: Integer;
W, H: Integer;
begin
GetClientDimensions(W, H);
if (DXISetup(GetNativeWindow())) then
begin
writeln('DXI setup succeeded');
Bmp := PtrToBmp(W, H, DXIImagePointer());
DebugBitmap(Bmp);
FreeBitmap(Bmp);
Bmp := PtrToBmp(W, H, DXIDebugPointer());
ClearBox(Bmp, IntToBox(0, 0, W - 1, H - 1));
DrawBox(Bmp, IntToBox(0, 0, 100, 100));
FreeBitmap(Bmp);
end else
writeln('Failed to setup DXI.');
end.
Results:
http://i.imgur.com/dQj9eWO.jpg
bonsai
08-04-2015, 08:35 AM
EDIT: I updated the Visual Studio source to include the below fixes (didn't update the VS .dll modules though..).
Results:
http://i.imgur.com/dQj9eWO.jpg
I duplicated this result, thank you!!
The size mismatch was targeting the whole window instead of the frame. This fix did the rest.
Did you mean you checked code in somewhere, because I didn't see anything in github. There was some code you pasted a page back or so that I don't see either.
Brandon
08-04-2015, 01:47 PM
I duplicated this result, thank you!!
The size mismatch was targeting the whole window instead of the frame. This fix did the rest.
Did you mean you checked code in somewhere, because I didn't see anything in github. There was some code you pasted a page back or so that I don't see either.
:) Glad you got it working.
https://github.com/Brandon-T/DXI/releases/tag/v0.6
VisualStudioBuild has the updated source. I will create a branch for VS and check it into it later and maybe update the current code to do the same (allow browser drawing/debugging and mapping via WindowHandle).
alar82
08-19-2015, 02:53 PM
Can I has updated d3d9 source plx=?
I build one with visual studio 2015 from your dxi attched code. Dosent load with jagexlauncher.exe. Included d3d9 does load and displays blackscreen.
Updated d3d9 Works fine.
bonsai
08-19-2015, 08:53 PM
I got a working version by doing the following:
Grab the zip file from here (https://github.com/Brandon-T/DXI)
There's a d3d9-visual folder that should build ok. Incorporate the two changes from post 223 and comment out the calls to messageboxa in hooks.cpp
I also changed Direct3DDevice9Proxy.cpp so it would create the shared memory under smart. This allowed DXIsetup() to succeed when using smart (although it's not updating the screen info so it's kind of worthless).
HRESULT Direct3DDevice9Proxy::EndScene()
{
bool isMinimised = false;
if (SmartGlobal && SmartGlobal->version)
{
// bonsai copied to get DXIsetup working under smart
if (!SharedImageData || !SharedImageData->GetDataPointer())
{
CreateSharedMemory(GetCurrentProcessId()) || OpenSharedMemory(GetCurrentProcessId());
}
alar82
08-26-2015, 06:12 AM
Someone has commented out messagebox in source allready. Thats why I thought it wasnt loading. (no message at my compiled). But now I has no idea what to do with it :p
Fitta
08-31-2015, 11:57 AM
Brandon, if you get this semi-working I'd be happy to develop a include similar to SRL-6 for it. Got a lot of free time coming up!
Brandon, if you get this semi-working I'd be happy to develop a include similar to SRL-6 for it. Got a lot of free time coming up!
Same here Brandon;
As a matter of fact a lot of people would be interested in working on this!
Fitta; Ross; Communication is the only thing left to write, everything else is pretty much done.
iAmaGz
12-20-2015, 03:42 AM
Did you guys ever go anywhere with this? I was told to politely ask ;) :cool::staycool:
Did you guys ever go anywhere with this? I was told to politely ask ;) :cool::staycool:
I have time over Christmas if Brandon; hasn't already done it ;)
Twinki
12-21-2015, 06:12 PM
Yeah I can't wait for this, dxLib v0.1 would be an amazing Christmas present ;)
Yeah I can't wait for this, dxLib v0.1 would be an amazing Christmas present ;)
Pretty sure the guys who made oglib don't want to make one for directx, so you'll need a different naming system.
Pretty sure the guys who made oglib don't want to make one for directx, so you'll need a different naming system.
Says who? :)
Clarity
12-21-2015, 11:17 PM
Yeah I can't wait for this, dxLib v0.1 would be an amazing Christmas present ;)
Pretty sure the guys who made oglib don't want to make one for directx, so you'll need a different naming system.
Says who? :)
Well I personally don't feel like wasting time making an include that will be useless in a few months, although if the plugin is structured just like Brandon's, a simple copy-paste with some function name changes wouldn't be hard for those who want it.
Laquisha
01-20-2016, 04:33 AM
I had book marked the QFC: 198-199-113-65596566 but it doesn't seem to exist :S IIRC, there was a post by a mod with something to the effect of "We plan to support OpenGL for multiple platforms and we're looking into/keeping an eye on Direct-X 12".
I guess we can safely say it's confirmed now; NXT will make use of both DirectX and OpenGL. This plugin will probably become more relevant when NXT is released as we will probably see a lot more clients using these methods in the future. In terms of villavu and simba, I can see it having widespread acceptance and use if it's performance is up to par (which is what the fps tests on this thread have shown).
Twinki
01-20-2016, 04:52 AM
I guess we can safely say it's confirmed now; NXT will make use of both DirectX and OpenGL. This plugin will probably become more relevant when NXT is released as we will probably see a lot more clients using these methods in the future. In terms of villavu and simba, I can see it having widespread acceptance and use if it's performance is up to par (which is what the fps tests on this thread have shown).
In the Q&A livestream they said they wouldn't be supporting previous versions of DirectX since DX12 is around the corner, so the only rendering they're going to use is OGL until Vulkan and DX12 becomes a thing later on. If NXT will only have DX12 support, then I'd rather see Brandon take another look at the OGL Plugin or possibly Vulkan, since dxLib or whatever include uses the DX Plugin, will only be usable on Windows 10.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.