Posts: 1,018
Threads: 60
Joined: Mar 2008
06-27-2012, 07:39 PM
(This post was last modified: 06-27-2012, 07:47 PM by Boop.)
C-Code:
#ifndef CGAME_H
#define CGAME_H
struct sOpoint
{
int kind;
int x;
int y;
int action;
int dvx;
int dvy;
int oid;
int facing;
};
struct sBpoint
{
int x;
int y;
};
struct sCpoint
{
int kind;
int x;
int y;
int injury; //if its kind 2 this is fronthurtact
int cover; // if its kind 2 this is backhurtact
int vaction;
int aaction;
int jaction;
int daction;
int throwx;
int throwy;
int hurtable;
int decrease;
int dircontrol;
int taction;
int throwinjury;
int throwz;
};
struct sWpoint
{
int kind;
int x;
int y;
int weaponact;
int attacking;
int cover;
int dvx;
int dvy;
int dvz;
};
typedef struct
{
int kind;
int x;
int y;
int w;
int h;
int dvx;
int dvy;
int fall;
int arest;
int vrest;
int unknown1;
int effect;
int unknown2;
int unknown3;
int unknown4;
int unknown5;
int bdefend;
int injury;
int zwidth;
int unknown6;
} sItr;
typedef struct
{
int kind;
int x;
int y;
int w;
int h;
int unknown1;
int unknown2;
int unknown3;
int unknown4;
int unknown5;
} sBdy;
typedef struct
{
int exists;
int pic;
int state;
int wait;
int next;
int dvx;
int dvy;
int dvz;
int unknown1;
int hit_a;
int hit_d;
int hit_j;
int hit_Fa;
int hit_Ua;
int hit_Da;
int hit_Fj;
int hit_Uj;
int hit_Dj;
int hit_ja;
int mp;
int centerx;
int centery;
struct sOpoint opoint;
int unknown2;
int unknown3;
struct sBpoint bpoint;
struct sCpoint cpoint;
int unknown4;
int unknown5;
int unknown6;
struct sWpoint wpoint;
int unknown7;
int unknown8;
int unknown9;
int unknown10;
int unknown11;
int unknown12;
int unknown13;
int unknown14;
int unknown15;
int unknown16;
int unknown17;
int numOfItr;
int numOfBdy;
//vv these should be pointers to arrays or something... i dono
sItr *pItr;
sBdy *pBdy;
//vv these values are deprecated i think
int itr_x;
int itr_y;
int itr_w;
int itr_h;
int bdy_x;
int bdy_y;
int bdy_w;
int bdy_h;
//----------------------------------------
int unknown18;
char fname[20];
char (*pSoundFile)[20]; // maximum sound path is unknown actually
int unknown20;
} sFrame;
class CDataFile
{
public:
int walking_frame_rate;
char unknwn1[16];
double walking_speed;
double walking_speedz;
int running_frame_rate;
double running_speed;
double running_speedz;
double heavy_walking_speed;
double heavy_walking_speedz;
double heavy_running_speed;
double heavy_running_speedz;
double jump_height;
double jump_distance;
double jump_distancez;
double dash_height;
double dash_distance;
double dash_distancez;
double rowing_height;
double rowing_distance;
int weapon_hp;
int weapon_drop_hurt;
char unkwn2[1612];
int id;
int type;
int unkwn3;
int head; //probably pointers
char derp; // probably pointers
char unkwn4[159];
sFrame frames[400];
};
class CObject
{
public:
int umkwn1;
int unkwn2;
int invincible;
int unkwn3;
int x;
int y;
int z;
char unkwn4[12];
double x_accel;
double y_accel;
double z_accel;
double x_vel;
double y_vel;
double z_vel;
double x_real;
double y_real;
double z_real;
int frame;
int frame2;
int frame3;
int frame4;
char facing;
char unkwn5[15];
int cpoint_catcher;
int cpoint_timer;
int weapon_type;
int weapon_held_num;
int unknown6;
int something;
char unkwn7[12];
int fall;
int shaking;
int bdefend;
char unkwn8[10];
char holding_up;
char holding_down;
char holding_left;
char holding_right;
char holding_A;
char holding_J;
char holding_D;
char up;
char down;
char left;
char right;
char A;
char J;
char D;
char DrA;
char DlA;
char DuA;
char DdA;
char DrJ;
char DlJ;
char DuJ;
char DdJ;
char DJA;
char unkwn9[14];
int arest;
int vrest;
char unkwn10[396];
int attacked_object_num;
char unkwn11[116];
int clone;
int unkwn12;
int hp;
int dark_hP;
int max_hp;
int mp;
int reserve;
int unkwn13;
int unkwn14;
int pic_gain;
int bottle_hp;
char unkwn15[24];
int firzen_counter;
int unkwn16;
int armour_multiplier;
int unkwn17;
int total_attack;
char unkwn18[24];
int enemy;
int team;
CDataFile *dataFile;
};
class CBackground
{
public:
int width; //0x0
int zwidth1; //0x4
int zwdith2; // 0x8
int perspective1; //0xC
int perspective2; //0x10
int shadow1; //0x14
int shadow2; //0x18
int layerCount; //0x1c
char layer_BMPs[30][30]; //0x20
char shadowBMP[30]; //0x3a4
char name[30]; //0x3c2
int transparency[30]; //0x3e0
int layer_width[30]; // 0x458
int layer_x[30]; // 0x4d0
int layer_y[30]; // 0x548
int layer_height[30]; // 0x5c0
char derp[856];
};
class CFileManager
{
public:
CDataFile *dataFiles[500];
char IDONTEVENOMGWHATISTHISAHHHHHHH[81024480];
CBackground backgroudns[50];
};
class CGame
{
public:
int state; // 0x4
char exists[400]; // 0x194
CObject *objects[400]; // 0x7d4
CFileManager *manager; //FA4
};
#endif
|
I give you all the lf2 data structures! Just put
C-Code:
CGame *game = (CGame*)0x458B00;
|
(that's for 2.0 not sure about others) and you have access to all the known lf2 objects etc.
You need to exist in lf2 memory space for this to work, so you either need to inject a dll with an injector(like the realtime data changer used), have an exe that is modified to load a dll (this is how the dll framework worked) or use a directdraw wrapper (like the AI dll worked).
This makes working with lf2 a lot easier. Instead of doing things like
C-Code:
state = *(int*)(*(int*)(*(int*)(0x458C94+object_num*4)+0x368)+frame_num*0x178+0x7ac);
|
you can do
C-Code:
game->objects[object_num]->dataFile->frames[frame_num].state;
|
Basically you don't need to know all these random numbers and stuff any more
10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.
Posts: 410
Threads: 25
Joined: Sep 2008
More info >> here<<. (Click on "Go to spreadsheet view" at the top if you have stuff to contribute.)
Hiding users' signatures and avatars was the best decision ever.
hey blow :P ~ Bamboori
can I call ya koalafly? ~ Phil
Pogofly - Simoneon
k0a1af1y, looks much more stylish ~ Blue Phoenix
So hey, blow, say something! - Simoneon
Quack? ~ blow_fly98
Hi blow ~Ramond
So... is it decided that we call him "blow"? ~ Blue Phoenix
No. ~ blow_fly98
But blow, all the members now will follow us because of this convo. You're ruined!!! - Simoneon
Meh. But I'll leave this convo here anyway. ~ blow_fly98
meh koala is much more awesome so I will stick to that ~ Phil
Wait, what? Koalas can edit profiles? - Simoneon
lol, seems that i started a long discussion :P ~ Bamboori
You did, indeed. I wonder who will exceed the sig-limit... ~ Blue Phoenix
Please don't trash this. It's good eye-candy. ~ blow_fly98
koala has spoken and so shall it be =) ~ Phil
there're some html here, and bla bla bla, so I think I might exceed it. Period - Simoneon
WHY THE SPOILER?! ~ Blue Phoenix
didn't you spoiler the conversation yourself? ~ Bamboori
BLOW BLOW!!! YOU FORGOT TO WRITE NAKATO IN 'WE'RE WATCHING YOU'!!!!! - Simoneon
To0 8ad. H4 D045n't d0 any MoDdin9 at A11!!!!!!! ~ blow_fly98
Evil Sonidow does, eh? - Simoneon
Of course. Just n0t v4ry 0ft4n. ~ blow_fly98
WHY THE 1337-SPEAK?! ~ Blue Phoenix
Because I am a KOALA!!! ~ blow_fly98
To be honest, I thought they use Eucalyptus-Speal..........
......
......
D: - Simoneon
Noez, Simon forgot to close his notice! ~ Blue Phoenix
oh no its the end of the world! *panic* ~ Bamboori
Gzz Hizz Fz Mzzz
Anyone got a Eucalyptus-speak interpreter?
And did you know that a user can have more than 4 images in their signature if we edit it for them? Or am I just the last one to find out?
~ blow_fly98
OMG spoilers in spoilers! ~ Bamboori
OMG offtopic in offtopic! - Simoneon
OH HAI GUYZ, i didnt you see you thar :P ~ Alectric
Now, I seriously need to be a part of this. ~ SirFrog
Wasn't there something about childish mods editing signatures lately? ~ Reaper
What?!?! Where was it?!?!?! ~ blow_fly98
DO YOU HAVE SUGAR?! - Simoneon
I heard if you edit someone's signature enough, your profile automatically is set to Admin status. BP told me. ~ Alectric
then let's do this! ~ Bamboori
Just because I don't go around checking every single post and editing signatures doesn't mean that I don't mod here. I just don't check posts that aren't reported. ~ Evil Sonidow
Seriously. We should encourage people to start reporting more :/ - Simoneon
EvErYoNe'S pOsTeD hErE eXcEpT mH.
Hey, maybe we could report every single post just so ES could check them. ~ blow_fly98
You know, that's a hell lot of work. What about a rule that everyone has to report at least one post whenever he logs in? Or an auto-report function? ~ Reaper
I liked the report-part until we got to the point of an auto-report function. That's something that requires work --> No. ~ Blue Phoenix
Finally, I get to see some invisible users. *sniggers* ~ blow_fly98
Oh, i came back. Well, since im already here, i may as well shoot bees ~ Alectric
You know, the ducks are watching. Always watching... ~ SirFrog
Hmm, I think, Lauli is about to climax due to the awesomeness of this color-wall ~ Blue Phoenix
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<thead>
<tr>
<td class="thead">
<div class="expcolimage"><img src="images/unrealblack//collapse.gif" id="boardstats_img" class="expander" alt="[-]" title="[-]" /></div>
<div><strong>Board Statistics</strong></div>
</td>
</tr>
</thead>
<tbody style="" id="boardstats_e">
<tr>
<td class="tcat"><span class="smalltext"><strong>Who's Online</strong> </span></td>
</tr>
<tr>
<td class="trow1"><span class="smalltext">13 users active in the past 5 minutes (13 members, 0 of whom are invisible, and 0 guests).<br /><a href="member.php?action=profile&uid=838"><span style="color: #ff7f00"><b>Alectric</b></span></a>, <a href="member.php?action=profile&uid=17"><span style="color: #ff7f00"><b>Azriel</b></span></a>, <a href="member.php?action=profile&uid=26"><span style="color: #8888ff"><b>Bamboori</b></span></a>, <a href="member.php?action=profile&uid=1056"><span style="color: #008800"><b>blow_fly98</b></span></a>, <a href="member.php?action=profile&uid=15"><span style="color: #ff0000;"><b>Blue Phoenix</b></span></a>, <a href="member.php?action=profile&uid=5"><span style="color: #8888ff;"><b>Evil Sonidow</b></span></a>, <a href="http://www.lf-empire.de/forum/member.php?action=profile&uid=8"><span style="color: #8888ff;"><b>Lord Silva</b></span></a>, <a href="member.php?action=profile&uid=3"><span style="color: #8888ff;"><b>Marshall</b></span></a>, <a href="member.php?action=profile&uid=1"><span style="color: #ff0000;"><b>MH-Razen</b></span></a>, <a href="member.php?action=profile&uid=736"><span style="color: #8888ff;"><b>Phil</b></span></a>, <a href="member.php?action=profile&uid=10"><span style="color: #ff7f00;"><b>Ramond</b></span></a>, <a href="member.php?action=profile&uid=1659"><span style="color: #008800"><b>Reaper</b></span></a>, <a href="member.php?action=profile&uid=1317"><span style="color: #ff7f00;"><b>Simoneon</b></span></a>, <a href="member.php?action=profile&uid=245"><span style="color: #008800"><b>SirFrog</b></span></a></span></td>
</tr>
</tbody>
</table> | Avatar made by Alectric |
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
07-03-2012, 01:23 AM
(This post was last modified: 07-03-2012, 01:24 AM by Boop.)
C-Code:
#include "stdafx.h"
#include "lf2.h"
using namespace std;
template <class tType> tType __fastcall ReadMemoryType(HANDLE hProcess, void* pLocaton)
{
tType pType = {0};
ReadProcessMemory(hProcess,pLocaton,&pType,sizeof(tType),NULL);
return pType;
}
template <class tType> BOOL __fastcall WriteMemoryType(HANDLE hProcess,tType* pType ,void* pLocaton)
{
return WriteProcessMemory(hProcess,pLocaton,pType,sizeof(tType),NULL);
}
BOOL __fastcall GetProcessID(char* szWndName, unsigned long* pPID)
{
HWND hWnd = FindWindowA(szWndName,NULL);
if(hWnd != NULL)
if(GetWindowThreadProcessId(hWnd,pPID))
return TRUE;
return FALSE;
}
HANDLE __fastcall GetLF2Process()
{
DWORD dwPID;
if(!GetProcessID("Marti",&dwPID))
{
cerr << "DERP" << endl;
return NULL;
}
HANDLE hToken;
LUID pLUID;
TOKEN_PRIVILEGES pTokenPrivileges;
if(!OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hToken))
return NULL;
if(LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&pLUID))
{
pTokenPrivileges.PrivilegeCount = 1;
pTokenPrivileges.Privileges[0].Luid = pLUID;
pTokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken,FALSE,&pTokenPrivileges,sizeof(pTokenPrivileges),NULL,NULL);
}
CloseHandle(hToken);
return OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_QUERY_INFORMATION|PROCESS_VM_WRITE,FALSE,dwPID);
}
int main(int argc, char* argv[])
{
HANDLE hProcess = GetLF2Process();
if(hProcess == NULL)
{
system("pause");
return 0;
}
void* pDataFiles = ReadMemoryType<void*>(hProcess,(void*)0x4592D4);
cout << hex << pDataFiles << endl;
if(pDataFiles == NULL)
{
cerr << "LF2 Not Loaded" << endl;
system("pause");
return 0;
}
void* pDataFile = ReadMemoryType<void*>(hProcess,(void*)pDataFiles); // + 0x4 * datafileNum
CDataFile dataFile = ReadMemoryType<CDataFile>(hProcess,(void*)pDataFile);
cout << dataFile.walking_frame_rate <<endl;
dataFile.walking_frame_rate = 5;
//Stupid testing yaybecaus
WriteMemoryType<CDataFile>(hProcess,&dataFile,(void*)pDataFile);
dataFile = ReadMemoryType<CDataFile>(hProcess,(void*)pDataFile);
cout << dataFile.walking_frame_rate <<endl;
system("pause");
return EXIT_SUCCESS;
}
|
Some external frame data reading ;) (as in you don't have to exist in lf2's memory).
10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.
Thanks given by:
|