Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Decompiled DrawObjectOnViewport Function (1.03K) JPN

Joined
Oct 29, 2007
Messages
1,288
Reaction score
1,305
Hello everyone, today I want to share my decompilation of this function. Which makes it possible to modify the Rotation Angles: X,Y,Z and the Display Size of the Items on the Map Floor. Enjoy it!

NOTE: 0 ASM Code.
Item.cpp File:

#include "StdAfx.h"

cItem gItem;

int cItem::DrawObjectOnViewport(lpObjViewport lpObjView) // -> 0x005C0467
{
switch(lpObjView->ObjIndex)
{
case Demon_Pet:
lpObjView->AngleX = 0.f;
lpObjView->AngleY = 0.f;
lpObjView->AngleZ = 70.f;
lpObjView->Size = 0.2f;
break;

case Fairy_Pet:
lpObjView->AngleX = 0.f;
lpObjView->AngleY = 0.f;
lpObjView->AngleZ = 70.f;
lpObjView->Size = 0.4f;
break;

default:
return pObjOnViewport(lpObjView);
break;
}
// ----
return 0;
}

void cItem::InitDrawObjectOnViewport()
{
gToolKit.SetOp((LPVOID)oDrawObjectCall01,this->DrawObjectOnViewport,ASM::CALL);
gToolKit.SetOp((LPVOID)oDrawObjectCall02,this->DrawObjectOnViewport,ASM::CALL);
}

void cItem::Load()
{
this->InitDrawObjectOnViewport();
}

Structs.h File:


#ifndef __STRUCTS_H__#define __STRUCTS_H__#pragma pack(push,1)typedef struct{ /*+0*/ BYTE Unknown0; /*+1*/ BYTE Unknown1; /*+2*/ BYTE Unknown2; /*+3*/ BYTE Unknown3; /*+4*/ BYTE Unknown4; /*+5*/ BYTE Unknown5; /*+6*/ BYTE Unknown6; /*+7*/ BYTE Unknown7; /*+8*/ BYTE Unknown8; /*+9*/ BYTE Unknown9; /*+10*/ BYTE Unknown10; /*+11*/ BYTE Unknown11; /*+12*/ BYTE Unknown12; /*+13*/ BYTE Unknown13; /*+14*/ BYTE Unknown14; /*+15*/ BYTE Unknown15; /*+16*/ BYTE Unknown16; /*+17*/ BYTE Unknown17; /*+18*/ BYTE Unknown18; /*+19*/ BYTE Unknown19; /*+20*/ BYTE Unknown20; /*+21*/ BYTE Unknown21; /*+22*/ BYTE Unknown22; /*+23*/ BYTE Unknown23; /*+24*/ BYTE Unknown24; /*+25*/ BYTE Unknown25; /*+26*/ BYTE Unknown26; /*+27*/ BYTE Unknown27; /*+28*/ BYTE Unknown28; /*+29*/ BYTE Unknown29; /*+30*/ BYTE Unknown30; /*+31*/ BYTE Unknown31; /*+32*/ BYTE Unknown32; /*+33*/ BYTE Unknown33; /*+34*/ BYTE Unknown34; /*+35*/ BYTE Unknown35; /*+36*/ BYTE Unknown36; /*+37*/ BYTE Unknown37; /*+38*/ BYTE Unknown38; /*+39*/ BYTE Unknown39; /*+40*/ BYTE Unknown40; /*+41*/ BYTE Unknown41; /*+42*/ BYTE Unknown42; /*+43*/ BYTE Unknown43; /*+44*/ BYTE Unknown44; /*+45*/ BYTE Unknown45; /*+46*/ BYTE Unknown46; /*+47*/ BYTE Unknown47; /*+48*/ DWORD ObjIndex; /*+49*/ BYTE Unknown49; /*+50*/ BYTE Unknown50; /*+51*/ BYTE Unknown51; /*+52*/ BYTE Unknown52; BYTE Shift1[40]; /*+96*/ float Size; BYTE Shift2[164]; /*264*/ float AngleX; /*268*/ float AngleY; /*272*/ float AngleZ;}gObjViewport, *lpObjViewport;#pragma pack(pop)#endif
ScreenShot:
0A5CdXh - Decompiled DrawObjectOnViewport Function (1.03K) JPN - RaGEZONE Forums



Downloads:

Download Full Source Code (Main.dll):

2C57Bsx - Decompiled DrawObjectOnViewport Function (1.03K) JPN - RaGEZONE Forums


Download Main.exe Hooked + Compiled Main.dll:

aO8cX94 - Decompiled DrawObjectOnViewport Function (1.03K) JPN - RaGEZONE Forums
Credits:
Webzen
Kiosani
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Jul 18, 2015
Messages
51
Reaction score
5
can you share method decode struct ?, i can decode sub code with the IDA, but cant decode struct :(
 
Joined
Oct 29, 2007
Messages
1,288
Reaction score
1,305
can you share method decode struct ?, i can decode sub code with the IDA, but cant decode struct :(
Decode Struct ? bro... you only can decode a struct if you have some: .pdb from main, at least I'm thinking this. If you need re-make some struct you only must calc positions that you know of this. and put Shift[XX] bytes on fields that you don't know of this struct. size must be the same for your used Fields -> /*+96*/ float Size; for example, etc.
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
Decode Struct ? bro... you only can decode a struct if you have some: .pdb from main, at least I'm thinking this. If you need re-make some struct you only must calc positions that you know of this. and put Shift[XX] bytes on fields that you don't know of this struct. size must be the same for your used Fields -> /*+96*/ float Size; for example, etc.

Wonderful topic bro, could you someday come us teaching a little to pick up new effects and put on the older mains? Example: catch the effect of season 8 and put season 4
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
Item.cpp File:



Structs.h File:



ScreenShot:
0A5CdXh - Decompiled DrawObjectOnViewport Function (1.03K) JPN - RaGEZONE Forums



Downloads:




I found this reference in main 1.02.14 but did not want to decrease the size of the items see:

rhlqJbr - Decompiled DrawObjectOnViewport Function (1.03K) JPN - RaGEZONE Forums


The item does not change the size because it will?
 

Attachments

You must be registered for see attachments list
Joined
Oct 29, 2007
Messages
1,288
Reaction score
1,305
I found this reference in main 1.02.14 but did not want to decrease the size of the items see:

rhlqJbr - Decompiled DrawObjectOnViewport Function (1.03K) JPN - RaGEZONE Forums


The item does not change the size because it will?

because here you have a different struct lpObjViewport bro... anyways are you sure that this is equivalent function on your old school main ?? If your Answer it's YES, then you must remake it ! :):

Ex for your main ObjIndex(using your Screenshot from reference at: 0x005F5478):


/*+0*/ BYTE Unknown0;
/*+1*/ BYTE Unknown1;
/*+2*/ WORD ObjIndex;


PS: I can try to make for u, pass me your main.exe + your DLLs (ogg.dll, wzAudio.dll & vorbisfile.dll).

PS 2: I'm thinking that by your Screenshot... I mean.. using your showed function on your Screenshot... your struct is something like this:

/*+28*/ float AngleX;
/*+32*/ float AngleY;
/*+36*/ float AngleZ;

:sleep:
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Jan 15, 2017
Messages
18
Reaction score
1
Hello. Can you give me offset for this function in 1.04D main.exe? Thx.
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
because here you have a different struct lpObjViewport bro... anyways are you sure that this is equivalent function on your old school main ?? If your Answer it's YES, then you must remake it ! :):

Ex for your main ObjIndex(using your Screenshot from reference at: 0x005F5478):


/*+0*/ BYTE Unknown0;
/*+1*/ BYTE Unknown1;
/*+2*/ WORD ObjIndex;


PS: I can try to make for u, pass me your main.exe + your DLLs (ogg.dll, wzAudio.dll & vorbisfile.dll).

PS 2: I'm thinking that by your Screenshot... I mean.. using your showed function on your Screenshot... your struct is something like this:

/*+28*/ float AngleX;
/*+32*/ float AngleY;
/*+36*/ float AngleZ;

:sleep:


Yes I searched all references and gave me this function I tried to use like this:

Int Type = * (WORD *) (Struct + 2);

Direct without using struct and also in asm but did not change the size;

My main is this:


Thankiu!
 
Joined
Oct 29, 2007
Messages
1,288
Reaction score
1,305
Yes I searched all references and gave me this function I tried to use like this:

Int Type = * (WORD *) (Struct + 2);

Direct without using struct and also in asm but did not change the size;

My main is this:


Thankiu!

your main.exe named like: 'MyPrincipal' is not the same main.exe that in your ScreenShot bro... :huh::mellow: anyways... your posted main.exe have the same struct size, then maybe this can be useful for you:

Code:
// Main 1.02.14 Protocol: ??? (32 Item Index)
#pragma pack(push,1)
typedef struct            // -> Total Size: ?
{    
      /*+0*/        BYTE Unknown0;    
      /*+1*/        BYTE Unknown1;
      /*+2*/        WORD ObjIndex;
      /*+3*/        BYTE Unknown2;
      /*+4*/        BYTE Unknown3;
      /*+5*/        BYTE Unknown4;
      /*+6*/        BYTE Unknown5;
      /*+7*/        BYTE Unknown6;
      /*+8*/        BYTE Unknown7;
      /*+9*/        BYTE Unknown8;
      /*+10*/       BYTE Unknown9;
      /*+12*/       DWORD Size;
      /*+16*/       float PosX;
      /*+20*/       float PosY;
      /*+24*/       float PosZ;
      /*+28*/       float AngleX;
      /*+32*/       float AngleY;
      /*+36*/       float AngleZ;
}gObjViewport, *lpObjViewport;
#pragma pack(pop)

PS: In old school main.exe (like your main) that use ITEM_STRUCTURE from: 32 Item Index by every Item Type... in lpObjViewport Struct Size field is: /*+12*/ DWORD Size; sincerely I don't know why... but anyways you can try to use: float values on code if you make a small Cast first something like this:

Cast Ex:

Code:
case Demon_Pet:
lpObjView->AngleX    = 0.f;
lpObjView->AngleY    = 0.f;
lpObjView->AngleZ    = 70.f;
lpObjView->Size        = ([B][COLOR=#00cc99]DWORD[/COLOR][/B])0.2f;
break;

PS 2: I hope this has been helpful to you... don't forget that your main works with: 32 as maximum Index, so: ObjIndex must be matched to a formula like this:

Main 1.02.14 Protocol: ??? ObjectId Formula:

Code:
#define ObjectId(x,y)        ((x*[B][COLOR=#800080]32[/COLOR][/B])+y+[COLOR=#ff0000][B]530[/B][/COLOR]) // -> 530 in hex: (0x212) is [B][COLOR=#ff0000]Item Offset in Array[/COLOR][/B] from: 1.02.14 main
 
Last edited:
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
your main.exe named like: 'MyPrincipal' is not the same main.exe that in your ScreenShot bro... :huh::mellow: anyways... your posted main.exe have the same struct size, then maybe this can be useful for you:

Code:
// Main 1.02.14 Protocol: ??? (32 Item Index)
#pragma pack(push,1)
typedef struct            // -> Total Size: ?
{    
      /*+0*/        BYTE Unknown0;    
      /*+1*/        BYTE Unknown1;
      /*+2*/        WORD ObjIndex;
      /*+3*/        BYTE Unknown2;
      /*+4*/        BYTE Unknown3;
      /*+5*/        BYTE Unknown4;
      /*+6*/        BYTE Unknown5;
      /*+7*/        BYTE Unknown6;
      /*+8*/        BYTE Unknown7;
      /*+9*/        BYTE Unknown8;
      /*+10*/       BYTE Unknown9;
      /*+12*/       DWORD Size;
      /*+16*/       float PosX;
      /*+20*/       float PosY;
      /*+24*/       float PosZ;
      /*+28*/       float AngleX;
      /*+32*/       float AngleY;
      /*+36*/       float AngleZ;
}gObjViewport, *lpObjViewport;
#pragma pack(pop)

PS: In old school main.exe (like your main) that use ITEM_STRUCTURE from: 32 Item Index by every Item Type... in lpObjViewport Struct Size field is: /*+12*/ DWORD Size; sincerely I don't know why... but anyways you can try to use: float values on code if you make a small Cast first something like this:

Cast Ex:

Code:
case Demon_Pet:
lpObjView->AngleX    = 0.f;
lpObjView->AngleY    = 0.f;
lpObjView->AngleZ    = 70.f;
lpObjView->Size        = ([B][COLOR=#00cc99]DWORD[/COLOR][/B])0.2f;
break;

PS 2: I hope this has been helpful to you... don't forget that your main works with: 32 as maximum Index, so: ObjIndex must be matched to a formula like this:

Main 1.02.14 Protocol: ??? ObjectId Formula:

Code:
#define ObjectId(x,y)        ((x*[B][COLOR=#800080]32[/COLOR][/B])+y+[COLOR=#ff0000][B]530[/B][/COLOR]) // -> 530 in hex: (0x212) is [B][COLOR=#ff0000]Item Offset in Array[/COLOR][/B] from: 1.02.14 main

Bro sorry to waste your time, but unfortunately this offset comes from the protocol recv, and seems not to be used I used breakpoint before starting the main after I started it and I entered the character in no time used the function and unfortunately it was the only reference Closer to the one you posted, I think the older ones do not have these options, thanks for trying to help me!
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
Item.cpp File:



Structs.h File:



ScreenShot:
0A5CdXh - Decompiled DrawObjectOnViewport Function (1.03K) JPN - RaGEZONE Forums



Downloads:




Unfortunately I ran the whole main, I modified several places where I used 0x1C 0x18 0x20 and 0x24, but I did not find any that modified the size of the item in the character, I think this is not possible in the old versions, if it were you would have some Idea of where it might be? So that I can continue my search
 

Attachments

You must be registered for see attachments list
Joined
Mar 13, 2008
Messages
758
Reaction score
1,002
Unfortunately I ran the whole main, I modified several places where I used 0x1C 0x18 0x20 and 0x24, but I did not find any that modified the size of the item in the character, I think this is not possible in the old versions, if it were you would have some Idea of where it might be? So that I can continue my search

You can do it in any version. Change size rotate create own movements change color and more. First learn how work the character and later try work with items to decode struct . Both are similar
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
You can do it in any version. Change size rotate create own movements change color and more. First learn how work the character and later try work with items to decode struct . Both are similar

Hello, thank you for responding, but I've already been able to move the struct quite a bit, but I never find a place where I lock the "size" of the pet, I think I only hooks the function before because always the size changes you could give me a hint A function that I might be modifying?
 
Unknown Place
Joined
Mar 7, 2013
Messages
580
Reaction score
87
In struct of otem character and objects the size of any are in struct +0xC



In struct of otem character and objects the size of any are in struct +0xC

This depends of the compiler of course. Because depending on the version used, this might increase or not, like during all the updates microsoft has been doing on visual studio since the begining, by changing the size of stl containers as well. :)
 
Joined
Mar 13, 2008
Messages
758
Reaction score
1,002
This depends of the compiler of course. Because depending on the version used, this might increase or not, like during all the updates microsoft has been doing on visual studio since the begining, by changing the size of stl containers as well. :)

Very bad the structure size of a app is same with all compiler.
Struct SITEM
Word isVisible

Word Itemd id
Dword unk0x4
Dword unk0x8
Float itemsize:size to here is 0xC



And to do some things you need know the size complete of struct
 
Unknown Place
Joined
Mar 7, 2013
Messages
580
Reaction score
87
Very bad the structure size of a app is same with all compiler.
Struct SITEM
Word isVisible

Word Itemd id
Dword unk0x4
Dword unk0x8
Float itemsize:size to here is 0xC



And to do some things you need know the size complete of struct
Not really, it depends in memory alignment options and also in optimization options, so the size can indeed vary as I've saw it happening in many different cases, not exactly this one, but just saying it's not something static for sure.
 
Back
Top