WOW! No new MHS since August Spiro?

Discussions Related to Game Hacking and Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

Re: WOW! No new MHS since August Spiro?

Postby esco » Fri Nov 20, 2009 11:10 am

L. Spiro wrote:To perform an external memory copy:

Code: Select all
BYTE bBuffer[sizeof( SPRITE )];
ReadProcessMemory( GetCurProcessHandle(), (LPCVOID)&currentenemy, bBuffer, sizeof( SPRITE ), NULL );
WriteProcessMemory( GetCurProcessHandle(), (LPVOID)&currentenemy2, bBuffer, sizeof( SPRITE ), NULL );




Thanks for the snippet spiro. Of course your code was correct.... but what I was trying to do doesn't work. If something shows up in what would correspond for currentenemy2, when it is move to currentenemy1 the sprite vanishes. It's like it was never there and I don't understand why.
Code: Select all
extern SPRITE enemy[1] = { "", 0x0062dcd8 +0x003951e0};
extern SPRITE enemy2[1] = { "", 0x0062d118 +0x003951e0};
int whichvar;
int count;
{whichvar = 1;}
for (count = 0; count < 16; count++)
   { 
     
      if (enemy[count].sprite2 == -2145557916) {bat(); }      //72
      if (enemy2[count].sprite2 == -2145557916) {whichvar = 2; bat();}      //72
   }   
   
void bat ()
{
extern SPRITE currentenemy = { "", &enemy[count]};
extern SPRITE currentenemy2 = { "", &enemy2[count]};
if (whichvar == 2)
{
   {whichvar = 0;}
   ReadProcessMemory( GetCurProcessHandle(), (LPCVOID)&currentenemy, bBuffer, sizeof( SPRITE ), NULL );
   WriteProcessMemory( GetCurProcessHandle(), (LPVOID)&currentenemy2, bBuffer, sizeof( SPRITE ), NULL );
}   

BLAH BLAH
}



What I was trying to do was increase the framerate of the game because with a loop running 32X it drops to 54-57. With a loop of 16x it stay at 57-60 FPS.

One way to do this was to write all my scripts in each stage twice so that the loop is only running 16x, then double up on vars so basically:

Code: Select all
extern SPRITE enemy[1] = { "", 0x0062dcd8 +0x003951e0};
extern SPRITE enemy2[1] = { "", 0x0062d118 +0x003951e0};
int count;

for (count = 0; count < 16; count++)
   { 
      if (enemy[count].sprite2 == -2145559892) {bat();}
      if (enemy2[count].sprite2 == -2145559892) {bat2();}
    }

void bat()
{
extern SPRITE currentenemy = { "", &enemy[count]};
  BLAH BLAH
}

void bat2()
{
extern SPRITE currentenemy2 = { "", &enemy2[count]};
  BLAH BLAH
}


Code space wise this is of course retarded, BUT it does make the game run way smoother. Where as with this:

Code: Select all
extern SPRITE enemy[1] = { "", 0x0062dcd8 +0x003951e0};
int count;

for (count = 0; count < 32; count++)
   { 
      if (enemy[count].sprite2 == -2145559892) {bat();}
    }

void bat()
{
extern SPRITE currentenemy = { "", &enemy[count]};
  BLAH BLAH
}


It looks better code wise, but makes the game run slower due to the looping. Any suggestions?

P.S. In reference to script builder I may feel REALLY stupid when I hear the answer but I just couldn't figure out how to put a union into it. Do I just set the offsets the same when I add the names for the various ones in??

EDIT:

Image

This is odd..... the offsets were initially 0,2,4, 6, 8, c,10, 12. But the minute I saved the structure and went back in, it changes them. Would this effect my scripts in game or can I just disregard it?
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Re: WOW! No new MHS since August Spiro?

Postby L. Spiro » Fri Nov 20, 2009 1:51 pm

If you are sure that you need to duplicate code in order to make the game run smoothly, you can write the code into a file and #include it in the places where it needs to be copied. This allows you to write it once and easily put it in two places.
If something in the code needs to change from one place to the other you can use macros to define something before #including the file.

This is NOT a professional coding strategy. It should normally be avoided in real code production, but it is not such a serious offense in L. Spiro with non-professional projects.





The Struct Builder has no relationship to scripts.
Sadly, it is buggy as hell and I do not recommend making too many modifications to a structure. It will work fine if you build the whole structure from scratch to finish without removing or editing anything, but somehow my implementation was utterly retarded (one of the reasons I did not finish it AND I quit on MHS) and causing structure members to move inside the structure has some chance of desyncing them in the tree view, meaning it lies to you about the member data and then suddenly you get surprised when you reload it and find different offsets or additional members you did not know were there.


Implement unions by giving them the same offsets.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Re: WOW! No new MHS since August Spiro?

Postby esco » Sat Nov 21, 2009 5:31 am

So basically leave the structure builder alone. No worries.

As for my code using the info you gave me above wouldn't help much. So let me ask another question:

Is there a way to do this, without getting "undefined" errors for currentenemy?

extern SPRITE enemy[1] = { "", 0x0062dcd8 +0x003951e0};
extern SPRITE enemy2[1] = { "", 0x0062d118 +0x003951e0};
Int var;

If (var ==1) {extern SPRITE currentenemy = { "", &enemy[count]};}
else {extern SPRITE currentenemy = { "", &enemy2[count]};}

P.s. Corrected my syntax now that I am home.
Esco.... the name says it all. New Yorikan for life.
User avatar
esco
NULL
 
Posts: 148
Joined: Mon Sep 18, 2006 2:25 am
Location: Florida, a.k.a. the US's version of hell!

Re: WOW! No new MHS since August Spiro?

Postby jhonsadins » Thu Jul 08, 2010 12:25 pm

It is buggy as hell and I do not recommend getting too many changes to a structure. Function properly if you build an entire structure from beginning to end without removing anything or editing ..
jhonsadins
I Have A Few Questions
 
Posts: 5
Joined: Wed Jul 07, 2010 8:28 pm

Re: WOW! No new MHS since August Spiro?

Postby L. Spiro » Fri Jul 09, 2010 7:49 am

esco wrote:So basically leave the structure builder alone. No worries.

As for my code using the info you gave me above wouldn't help much. So let me ask another question:

Is there a way to do this, without getting "undefined" errors for currentenemy?

extern SPRITE enemy[1] = { "", 0x0062dcd8 +0x003951e0};
extern SPRITE enemy2[1] = { "", 0x0062d118 +0x003951e0};
Int var;

If (var ==1) {extern SPRITE currentenemy = { "", &enemy[count]};}
else {extern SPRITE currentenemy = { "", &enemy2[count]};}

P.s. Corrected my syntax now that I am home.



currentenemy must be defined outside of the if/else.


Code: Select all
extern SPRITE currentenemy = { "", (var == 1) ? &enemy[count] : &enemy2[count] }; }


And yes the Struct Builder is unusually buggy.
I planned to fix it in the next release, but the next release never came.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Previous

Return to General Related Discussions

Who is online

Users browsing this forum: No registered users and 0 guests