Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Perfect World
You last visited: Today at 15:11

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Need some help calling function for height

Discussion on Need some help calling function for height within the Perfect World forum part of the MMORPGs category.

Reply
 
Old   #1
 
Interest07's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
Need some help calling function for height

Hey there, for some reason I keep crashing upon trying to call this function and it's really pissing me off. I was wondering if somebody could give me some advice as to what I'm doing wrong

The function is being called inside a function starting at address 0x465730 in PWI

The function I'm looking for is called twice here, namely at 0x4657C7 and 0x465879. The code where it is called looks something like this:


Now, I'm interested in the value that is put into EAX right after the function call. What this function does: It takes in a pointer to your coords, a pointer to the result and a pointer to the angles of the floor you're standing at, oh and 1000.0 (god knows what for).

In the result it will store some coords again, among which is the height of whatever object is right under you (for example the floor). The reason I want to call this function, is that instead of your character's coordinates I'd throw in some random other coords and see the height of whatever object at that point, so I'd know whether I can jump over it, wallhack through it, or simply have to avoid that spot.

You can get the height of any coord in about 256 meter radius around you. I've managed to get results I want by setting breakpoints in MHS and automatically increasing the character's coords, so I know it is possible and shouldn't crash because of that.

Sadly, when I try to inject some opcode to call it with custom coordinates (or even my own) the stupid game crashes after it returns from the function. Obviously I'm doing something wrong in the opcode I use to call the function, but I'm lost as to what is causing this.

Some code I've used to try it:

Code:
            byte[] functionOpcode = new byte[] 
            { 
                0x60,                           //PUSHAD
                0x9C,                           //PUSHFD
                0x68, 0x00, 0x00, 0x7A, 0x44,   //PUSH 1000.0F
                0x68, 0x78, 0x56, 0x34, 0x12,   //PUSH anglesAddress
                0x68, 0x89, 0x67, 0x45, 0x23,   //PUSH returnCoordsAddress
                0x68, 0x90, 0x78, 0x56, 0x34,   //PUSH playerCoordsAddress
                0xB8, 0xA0, 0x88, 0x40, 0x00,   //MOV EAX, funcAddress
                0xFF, 0xD0,                     //CALL EAX
                0x9D,                           //POPFD
                0x61,                           //POPAD
                0xC3                            //RET
            };

            int opcodeAddress = MemFunctions.AllocateMemory(processHandle, functionOpcode.Length);
            MemFunctions.MemWriteBytes(processHandle, opcodeAddress, functionOpcode);

            int anglePtrAddress = opcodeAddress + 8;
            int returnPtrAddress = opcodeAddress + 13;
            int coordPtrAddress = opcodeAddress + 18;
            int functionAddress = opcodeAddress + 23;

            //Handle angle
            int anglePtr = MemFunctions.AllocateMemory(processHandle, 12);

            int playerPointer = player.getPlayerAddress();

            MemFunctions.MemWriteInt(processHandle, anglePtrAddress, playerPointer + 0xBAC);

            //Return values
            int returnPtr = MemFunctions.AllocateMemory(processHandle, 4);
            MemFunctions.MemWriteInt(processHandle, returnPtrAddress, returnPtr);


            //Current Coordinates
            int coordPtr = MemFunctions.AllocateMemory(processHandle, 12);

            Coordinates currentCoords = player.coordinates;

            MemFunctions.MemWriteFloat(processHandle, coordPtr + 0, currentCoords.x);
            MemFunctions.MemWriteFloat(processHandle, coordPtr + 4, currentCoords.y + 1);
            MemFunctions.MemWriteFloat(processHandle, coordPtr + 8, currentCoords.z);
            MemFunctions.MemWriteInt(processHandle, coordPtrAddress, coordPtr);

            //Run the opcode
            IntPtr threadHandle = MemFunctions.CreateRemoteThread(processHandle, opcodeAddress);

            //Wait for opcode to be done
            MemFunctions.WaitForSingleObject(threadHandle);

            float result = MemFunctions.MemReadFloat(processHandle, returnPtr);

            //Close the thread
            MemFunctions.CloseProcess(threadHandle);

            return result;
When I run it, right around the time I get the result, the client crashes. Sometimes it gives me the value, sometimes not.

Any help would be appreciated
Interest07 is offline  
Old 07/27/2011, 03:07   #2
 
elite*gold: 0
Join Date: Jul 2009
Posts: 39
Received Thanks: 0
Did you debug it in Olly? - Screenshot?
Shortpants is offline  
Old 07/27/2011, 06:57   #3
 
Interest07's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
Quote:
Originally Posted by Shortpants View Post
Did you debug it in Olly? - Screenshot?
Hmm no, I try to avoid using olly for breakpoints if I can, especially with functions that get hit a couple of times per second. Something tells me the function simply can't be called on its own, because it messes with other things in the client.
Interest07 is offline  
Reply


Similar Threads Similar Threads
Height Map Editor
01/04/2012 - Metin2 PServer Guides & Strategies - 18 Replies
Hey found randomly a Metin2 Height Map Editor. Hme is a 2D program, used for creating, manipulating and viewing height maps. A height map is a 2D representation of a 3D terrain. Each 'color' represents a height. Anyway, if you are reading this page, I assume you do have a good idea about what height maps really are, so I won't go in further details explaining it. Point is, so far, I never seen a GOOD terrain editor. Most of them are 3D editors, and that doesn't give you a feeling of...
Height
08/21/2010 - Metin2 Private Server - 3 Replies
huhu, ich hab wieder mal ein Problem ich bin Photoshop anfänger, vll weiß ich es deswegen nicht aber wenn ich in der height datei den farbton um 1% änder is das ja schon ein großer unterschied... kann ich iwi auch weniger als einen % verändern?
Help, calling an ingame function
03/13/2010 - General Coding - 2 Replies
Im trying with my dll to set off the "set stat function". The one that u press when you add a stat point to str, dex or what ever. My goal is to make players able to set there Stats to whatever they use to have from an earlier saved point. So if you play against different sort of mobs or players you reform your stats to be suetable for that sertan task in just 1 second right where you stand. Im thinking this is very useful for many ppl here. So now i could use help with the actuall call of...
Help with calling this function!
03/13/2010 - 12Sky2 - 6 Replies
First off: sorry for my poor english! Im trying with my dll to set off the "set stat function". The one that u press when you add a stat point to str, dex or what ever. My goal is to make players able to set there Stats to whatever they use to have from an earlier saved point. So if you play against different sort of mobs or players you reform your stats to be suetable for that sertan task in just 1 second right where you stand. Im thinking this is very useful for many ppl here. So now i...
Calling function in a game
03/29/2009 - General Coding - 1 Replies
Hai guise, I'm a stupid morron but how can I make a hook in c++ that will use Gameplay::GetMoney(); to return the current amount of Gold I have? http://www.bilderkiste.org/show/original/0bba0c93 80a21de4810c1429cbc287c9/call.jpg



All times are GMT +1. The time now is 15:14.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.