Sasami's Ragnarok World Forums
Register | Login | Logout | Edit profile | Avatars
Views: 410016
Main | Memberlist | Member pages | Online users
Ranks | Chat | New Chat | FAQ | Search | Photo album
04-28-24 04:47 AM
Sasami's Ragnarok World Forums (LOCKED) - Programming/reverse engineering discussion - Plz help Sesami! |
Pages: 1 2Next newer thread | Next older thread
User
Post
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-08-02 07:57 PMQuote | Edit | Delete
Hello Sesami!
I looked at you VB tutorial on you homepage. Now i got it to read out the memory and so on. The only problem is, that i didnt get it, to display the text in ro without blinking... Can you help me???
Im using Borland Delphi 6, its like Borland C! If you can give me some source, it doesnt matter if its C or Vb or something. Some source is better than no source!

Thanks!

EgoFelix


(edited by EgoFelix on 05-08-02 03:00 PM)
pragma7









Since: 04-26-02
From: USA, NJ

Since last post: 7831 days
Last activity: 7844 days
Posted on 05-08-02 08:12 PMQuote | Edit | Delete
That's covered in the tuturial, look again...

Rob
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-08-02 08:14 PMQuote | Edit | Delete
Yes i know, but i cant do it alone...
Always hangs up all...
Can oyu help me?


(edited by EgoFelix on 05-08-02 03:15 PM)
pragma7









Since: 04-26-02
From: USA, NJ

Since last post: 7831 days
Last activity: 7844 days
Posted on 05-08-02 08:18 PMQuote | Edit | Delete
As far as I know (I havn't tried it yet), a patch was created that changed values of within the executable...the vb program simply applies these changes.

Rob
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-08-02 08:23 PMQuote | Edit | Delete
My Friend told me to install a hook into the refresh of the screen, so i can add my text/pics and than the screen is refreshed first. My problem is now, that i have problems installing that hook... Maybe someone can help me!
If you want to see the source (its Borland Delphi 6 enterprise editon) just say it...

Thnaks
Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7359 days
Last activity: 7359 days
Posted on 05-08-02 08:27 PMQuote | Edit | Delete
what exactly are you trying to do?
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-08-02 08:30 PMQuote | Edit | Delete
I wanted to code my own Exp Viewer for training and than i wanna see, what i do.
Maybe some input addons, more hotkeys or something... Sending Keys to Ro isnt a problem yet, so a dancer were in too
Just need that display help, to make some menus in ro
Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7359 days
Last activity: 7359 days
Posted on 05-08-02 11:05 PMQuote | Edit | Delete
you need to learn assembly then my friend.
jekki









Since: 04-30-02
From: usa

Since last post: 7995 days
Last activity: 7978 days
Posted on 05-09-02 01:49 AMQuote | Edit | Delete
haha assembly...

impossible to learn by urself. ( i tried)
SprintSlash









Since: 04-22-02

Since last post: 7953 days
Last activity: 7931 days
Posted on 05-09-02 02:13 AMQuote | Edit | Delete
Not impossible =P Just verrrrrry difficult ^^
Kyokushin-ka









Since: 05-02-02

Since last post: 7948 days
Last activity: 7981 days
Posted on 05-09-02 05:09 AMQuote | Edit | Delete
*gack* I still have Moterolla 68k siezures from my high-school days.
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-09-02 08:03 AMQuote | Edit | Delete
No I dont need assembly!
I Nearly got it now. You have to install a hook into the handle of Ragnarök, so you can cotrolt the refreshes! Every refresh will be send to you by the hook, so you can append your text to the screen, befor it will be refreshed...
I just need to edit the hook a bit, and then i got it!

hehehe

Maybe you can help me

Ego
Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7359 days
Last activity: 7359 days
Posted on 05-09-02 01:21 PMQuote | Edit | Delete
sounds like you are on the right track, good luck.
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-09-02 01:47 PMQuote | Edit | Delete
hehe, nerly got it now, the hook just didnt save the window, have to think on it, how to save it, thats all now

Mh, have a new Problem now...
Still flashing
Can you help me????
Maybe you can give me the source, how to display text in RO, without flashing or something?
I would be very thanked!


(edited by EgoFelix on 05-09-02 03:06 PM)
Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7359 days
Last activity: 7359 days
Posted on 05-09-02 09:42 PMQuote | Edit | Delete
I never got it to not flash, after trying out a ton of things and asking around, researching a lot and stuff, I never found a solution. I had some ideas but I never got around to trying to test them b/c I figured it would be much more efficient in the end to add it to the assembly code. Let me see if I can remember what my ideas where

Um, DX uses to HDCs, the screen and a flip one. The flip one is where all the changes are made then every certain amount of time, it's moved to the main screen. If you could find that back one and blit to there it may work. If they even do it that way.

The second is making a hook to find out when the refresh is and making it blit right before the refresh.

The last one was... I don't remember the last way I thought of

anyways, I don't know how these can be done, if they can be done, I never really found out, but good luck.
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-09-02 10:38 PMQuote | Edit | Delete
I tired the last one, but just dont know some commands for the hook.
Another problem is finding the right handle... I paste some code here now, of my half-working hook

library hook;

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DIrectMemory;

const
WindowName = 'Ragnarok'; //The Handle Name

var
HookHandle: Cardinal = 0;
I: Integer = 0;

function GetWindowHandle: HWND;
begin
Result := FindWindowByTitle(WindowName); //Finding the handle
end;

function GetWndText(WndH: HWND): string;
var
s: string;
Len: integer;
begin
Len:= GetWindowTextLength(WndH)+1;
if Len > 1 then
begin
SetLength(s, Len);
GetWindowText(WndH, @s[1], Len);
Result:= s;
end
else
Result:= '0';
end;

procedure WriteText;
var
MyHand: HWND;
MyDc: HDC;
MyCanvas: TCanvas;
begin
MyHand := FindWindow(nil,WindowName);
MyDc := GetWindowDC(MyHand);
MyCanvas := TCanvas.Create;
MyCanvas.Handle := MyDC;
BeginPath(MyCanvas.Handle);
MyCanvas.Font.Color := clRed;
MyCanvas.Font.Name := 'Arial';
MyCanvas.Font.Size := 10;
SetBkMode(MyCanvas.Handle, TRANSPARENT);
EndPath(MyCanvas.Handle);
MyCanvas.TextOut(20, 30, 'testtest');
MyCanvas.Free;
end;


function HookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM):
LRESULT; stdcall;
var
Window: HWND;
Hookwindow: HWND;
Msg: Cardinal;
NextTitle: array[0..260] of char;
begin
if nCode = HC_ACTION then begin
//Here all will be handeled
Window := TMsg(Pointer(lParam)^).hwnd; //Find Handle
Msg := TMsg(Pointer(lParam)^).message; //Find Message
if Msg = WM_PAINT then //If Handle is WM_PAINT THEN Do... (THIS IS PLACE WHICH IS WRONG)
begin
if GetWndText(Window) = 'Ragnarok' then //check the handle (ANOTHER BUG)
begin
WriteText;
end;
end;
// end;
Result := CallNextHookEx(HookHandle, nCode, wParam, lParam); //Next Hook beenden
end;

function InstallHook: Boolean; stdcall;
begin
Result := False;
if HookHandle = 0 then begin
HookHandle := SetWindowsHookEx(WH_GETMESSAGE, @HookProc, HInstance, 0); //Intall hook
Result := TRUE;
WriteText;
end;
end;

function UninstallHook: Boolean; stdcall;
begin
Result := UnhookWindowsHookEx(HookHandle); //Deinstall Hook
HookHandle := 0;
end;

exports
InstallHook,
UninstallHook;

end.

MAybe you can help me, finding out the bugs...
I hope!

Thanks

Ego
Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7359 days
Last activity: 7359 days
Posted on 05-10-02 12:53 AMQuote | Edit | Delete
by glancing through that, why use getwindowtext to check the handle again? i doubt the hdc is gonna ever change... um secondly, even if the hook does catch the paint, the paint will probably already have occured before you can blit to the window, right?
Kyokushin-ka









Since: 05-02-02

Since last post: 7948 days
Last activity: 7981 days
Posted on 05-10-02 01:17 AMQuote | Edit | Delete
Yet annother reason why white space and comments are important, and why I should learn VB, imo your screeeeeeewwwwwwwwweeeeeeeed...just kiddin', I'm gonna go through it line by line and maybe me lookin at your code will help you k.

// Imports Library hook, so far so good
library hook;

/* Uses a bunch of things out of that library I can't tell, wait I recognize classes, graphics, windows, graphics, etc, but wat are sysutils, ah well it's common crap, I can probably look it up no prob*/
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DIrectMemory;

// I'm guessin' it looks up the window to modify
const
WindowName = 'Ragnarok'; //The Handle Name


// The variables!
var
HookHandle: Cardinal = 0; // I don't know what a cardinal is...I'm guessin it's the hook handler thingey
I: Integer = 0; //BAD naming scheme, a integer called I...or is it a integer called Integer

///////////////////////////////////////////////////////////////////////////////////////////
// Da first function, it looks up the window to handle
function GetWindowHandle: HWND; // wat is a HWND

begin
Result := FindWindowByTitle(WindowName); /*Finding the handle (has result been initialized, do you have to declare something before you use it in VB?)*/
end;

//////////////////////////////////////////////////////////////////////////////////////////
// Rips the text out of the window
function GetWndText(WndH: HWND): string; // returns a string with the text you want
var
s: string; /*nice string name, one could easily tell it from your other string names with it being calles s and all*/
Len: integer; // The length of the text you got

begin
Len:= GetWindowTextLength(WndH)+1; /* The length of the text you want becomes equal to the Window text length plus 1 (since most comps start countin' at zero) of the window your lookin at*/
// if you have text do this
if Len > 1 then begin
SetLength(s, Len); /* Set the length of the string equal to the length of the text you have*/
GetWindowText(WndH, @s[1], Len); // Pull out the text and put it into the string
Result:= s; // Sets the result equal to the string you pulled out
end
else
Result:= '0'; /* Or else if there was no result nothing result becomes nothing(0) because that's what was returned (why not use null?)*/
end;

//////////////////////////////////////////////////////////////////////////////////////
// Write the text somewheres
procedure WriteText;
var
MyHand: HWND; /* MyHand becomes is one of those strange HWND things that's been floating around*/
MyDc: HDC; // MyDc becomes some other object that I have no idea what it is
MyCanvas: TCanvas; // Make a canvas to draw on

begin
MyHand := FindWindow(nil,WindowName); /* the hand thingy is set to the window name, or is it set to nill or does it go from nill to the window name, or is the first part of the function not needed (why not use FindWindowByTitle(WindowName))*/
MyDc := GetWindowDC(MyHand); // Your DC becomes the window's DC
MyCanvas := TCanvas.Create; // Make your canvas
MyCanvas.Handle := MyDC; // Put in a handler for the DC thing
BeginPath(MyCanvas.Handle); // If the handler is invoked (I'm only guessing)
MyCanvas.Font.Color := clRed; // Use red
MyCanvas.Font.Name := 'Arial'; // Arial
MyCanvas.Font.Size := 10; // 10pt font
SetBkMode(MyCanvas.Handle, TRANSPARENT); /*uhhh, to write something over the background in a transparent way, so you can see the background*/
EndPath(MyCanvas.Handle); // handler ends here
MyCanvas.TextOut(20, 30, 'testtest'); // Print out the test text onto the canvas
MyCanvas.Free; /* And ... free...up to do other things.....stop working with it?*/
end;

////////////////////////////////////////////////////////////////////////////////
// Da big one for da hook (which I have no idea what one of those is)
function HookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM):
LRESULT; stdcall;
var
Window: HWND; // set up your window
Hookwindow: HWND; // set up the window your hooking
Msg: Cardinal; // use that cardinal thing you initialized long time ago
NextTitle: array[0..260] of char; /* make a array of characters so big that you won't ever run out (unless you turn this in to a evil comp sci professor)*/

begin
if nCode = HC_ACTION then begin // If that action thing is equal to the code thing do this
//Here all will be handeled
Window := TMsg(Pointer(lParam)^).hwnd; //Find Handle
Msg := TMsg(Pointer(lParam)^).message; //Find Message
if Msg = WM_PAINT then //If Handle is WM_PAINT THEN Do... (THIS IS PLACE WHICH IS WRONG) // If the message given is a certian message then do this:
begin
if GetWndText(Window) = 'Ragnarok' then //check the handle (ANOTHER BUG)
// Check to make sure that the window being checked really is 'Ragnarok'
begin
WriteText; // Write in your text
end;
end;
// end; --If your not using this why is it here
Result := CallNextHookEx(HookHandle, nCode, wParam, lParam); //Next Hook beenden //--what is beenden, is it Before ending(no semicolon-your compiler should have picked that up)
end;

//////////////////////////////////////////////////////////////////////////////////////
// Install the hook into the window
function InstallHook: Boolean; stdcall; /* this isn't in the same function format as the rest of your functions, can VB do that?*/

begin
Result := False; /* Result is now false...can you do that, it used to be a character with the value '0' stored in it, now it's a boolean?*/
if HookHandle = 0 then begin // no hook do this
HookHandle := SetWindowsHookEx(WH_GETMESSAGE, @HookProc, HInstance, 0); //Intall hook in the window
Result := TRUE; // Result is now true...I never saw it initialized yet
WriteText; // Write the text to the window
end;
end;

/////////////////////////////////////////////////////////////////////////////////////
// Get the hook out of the window
function UninstallHook: Boolean; stdcall; // Yet agian, not in the same function format as the rest of your functions

begin
Result := UnhookWindowsHookEx(HookHandle); //Deinstall Hook--looks simple enough
HookHandle := 0; // Set the hook handle to zero
end;



// Export the Install Hook and Uninstall Hook out to other progs
exports
InstallHook,
UninstallHook;

end.


I do not pretend to have any knowledge whatsoever of VB. This is one reason why I recomend putting white space and comments in the code, so dumb people like me can understand it. Maybe my criticism can help you, or at least make you rethink your algorythm. But...I got a little bit of knowledge as to how some VB code looks (though I don't use it). And by the time I got through typeing this, someone probably already told you the answer.

[edit] Look up one post, I'm right, someone did get through before I did.


(edited by Kyokushin-ka on 05-09-02 08:19 PM)
Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7359 days
Last activity: 7359 days
Posted on 05-10-02 03:49 AMQuote | Edit | Delete
*is to lazy to read all the last post said*
his code is in c... not vb.
EgoFelix









Since: 05-08-02

Since last post: 7961 days
Last activity: 7961 days
Posted on 05-10-02 08:02 AMQuote | Edit | Delete
First to Kyokushin-ka:
hehe nope, its not c, its delphi!
You can download a trial version of it at www.borland.com!
So, now to the code...

I woudl explain a HWND as the Window...
A DC would be the hole inner of the forumlar, and Cavas is then the place, were the game is displayed...

It doesnt matter, if i use FindWindowByTitle or FindWindow, both find the same Handle

Uses are just unit, were functions and procedures are saved in, so i dont have to code all every time. For Example: I want to turn a string around. So i write the function in a unit called turn. Then i write in the uses the "turn" unit, and just got the function avaible! Its much easyer than writing every function new...

function HookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM):
LRESULT; stdcall;
That is the real hook...
IF a program will be repainted or something, the hook will know this befor its done.
So i can append my Text/Pics to the canvas, and after i done that, its repainted.
My only problem is, that i cant find the right handle for that! Using the handle Ragnarok is wrong, cauz every handle, has sub-handle. I dont know, how to get that sub-handle, and how to identify it. Thats all!



Result := CallNextHookEx(HookHandle, nCode, wParam, lParam); //Next Hook beenden //--what is beenden, is it Before ending(no semicolon-your compiler should have picked that up)

That means that the hook is completed...


-----------------------------------------------------------
Now to Sesami:
I have to check the handle always, the hook is produced, becaus every WM_PAINT will be send to the hook, doesnt matter, which handle. So i have to check, that its the ragnarok handle. If i dont do that, every Programm will get the text. Everywere will be a "testtest"
Now to problem. The sub-hdc has got no name... There are many sub-hdc without a name. I listed all handles, i can find, there were about 25 no-named handels.
Maybe you know a way...???


Thanks to you both!
Pages: 1 2Next newer thread | Next older thread
Sasami's Ragnarok World Forums (LOCKED) - Programming/reverse engineering discussion - Plz help Sesami! |
Edit/move/close/delete thread


Sasami's Ragnarok World

AcmlmBoard v1.7
© 2000-2001 Acmlm

Page rendered in 0.014 seconds.