ZSR Forums

=> Ocarina of Time => Topic started by: mzxrules on June 03, 2012, 04:49:28 AM



Title: MHS Thread
Post by: mzxrules on June 03, 2012, 04:49:28 AM
L. Spyro's Memory Hacking Software (or MHS for short) is a rather nifty program that allows you to look into a program and do all kinds of fun stuff with it.

One rather neat thing you can do with it is read memory values and perform calculations based off those values.

Since I'm terrible at starting threads, here's a script that calculates the distance traveled during during the last frame. It's not 100% accurate because the time value isn't always updated when Link can move I think (when just entering a scene I think).

Code:
VOID Lock(MHS_ADDRESS aAddress, INT iItemSize){
extern int off = { "project64.exe", 0xD6A1C }; //Grabs pointer value to the start of the 64's RAM for PJ64

extern short t = { "", (0x1EF6AC + off)}; //Grabs the current time frame
extern short tO = { "", (0x3FFF50 + off)}; //Grabs the previous time frame

//grab the current x,y,z coordinates
extern float xN = { "", (0x3FFDD4 + off) };
extern float yN = { "", (0x3FFDD8 + off) };
extern float zN = { "", (0x3FFDDC + off) };

//grab the previous frame's x,y,z coordinates
extern float xO = { "", (0x3FFF44 + off) };
extern float yO = { "", (0x3FFF48 + off) };
extern float zO = { "", (0x3FFF4C + off) };

//result is where we'll return our final value
extern float result = { "", aAddress };

//stores delta x, y, z
float x;
float y;
float z;

//temp values for calculating the speed
float u;
float v;
int i;

//if we're on the next frame
if (t != tO)
{
//get delta x, y, z
x = xN-xO;
y = yN-yO;
z = zN-zO;

//update our previous position/frame number
xO = xN;
yO = yN;
zO = zN;
tO = t;

//Begin calculating sqrt(x^2+y^2+z^2)

//u = x^2+y^2+z^2
u = ((x*x)+(y*y)+(z*z));

//some square root magic I don't quite understand.
i = * (int *) &u;
i = 0x1FBC5524 + i/2;
v = * (float *) &i;

//The more times this is repeated, the more accurate the result is
v = (v + u/v)*0.5f;
v = (v + u/v)*0.5f;

result = v;
}
}


Title: Re: Obligatory MHS Thread
Post by: ING-X on June 03, 2012, 11:38:08 PM
lmao

Anyways, Petrie gave me this list of MM addresses for MHS a while back. May as well attach it to this post so other people can access it more easily.


Title: Re: MHS Thread
Post by: mzxrules on August 20, 2014, 09:43:00 AM
Came up with a dynamic address for the Blue Warp timer, so that several values become one:

[project64.exe+D6A1C]+([[project64.exe+D6A1C]+1CA10C]&FFFFFF)+180h

The way it works is it captures the pointer at 1CA10C, which appears to be the last actor spawned with a particular... "actor typing" I guess. Blue warps are type 7 which seem to be shared with just navi, and some decor.

Haven't done extensive testing of it though


Title: Re: MHS Thread
Post by: Cosmo on August 20, 2014, 02:56:22 PM
Here are sockfolder's OoT memory addresses for mupen 0.5 rerecording
http://www.mediafire.com/?q4083u9w365eo (http://www.mediafire.com/?q4083u9w365eo)


Title: Re: MHS Thread
Post by: Jbop on August 22, 2014, 01:40:04 AM
Cheat Engine forever!


Title: Re: MHS Thread
Post by: mzxrules on November 16, 2014, 08:28:01 PM
Set specific stones/medallions (0 to not have, 1 to have). For this to work, the value must be locked, and the value being locked must be set to the start address of the stones/medallions stuff. (8011A674 in 1.0)
Code:
VOID Lock(MHS_ADDRESS aAddress, INT iItemSize){

bool Emerald = 0;
bool Ruby = 0;
bool Sapphire = 0;

bool M_Light = 0;
bool M_Forest = 0;
bool M_Fire = 0;
bool M_Water = 0;
bool M_Shadow = 0;
bool M_Spirit = 0;

bool S_Lullaby = 0;
bool S_Epona = 0;
bool S_Saria = 0;
bool S_Sun = 0;
bool S_Time = 0;
bool S_Storm = 0;

bool S_Minuet = 0;
bool S_Bolero = 0;
bool S_Serenade = 0;
bool S_Requiem = 0;
bool S_Nocturne = 0;
bool S_Prelude = 0;

bool O_Stone = 0;
bool O_GerudoCard = 0;
bool O_GoldSkull = 0;

char HeartPieces = 0;

//Code
extern unsigned int r = { "", aAddress };
unsigned int result = 0;

result += (int)HeartPieces <<28;
result += (int)Test(
O_GoldSkull, O_GerudoCard, O_Stone, Sapphire,
Ruby, Emerald, S_Storm, S_Time) << 16;
result += (int)Test(
S_Sun, S_Saria, S_Epona, S_Lullaby,
S_Prelude, S_Nocturne, S_Requiem, S_Serenade) << 8;
result += Test(
S_Bolero, S_Minuet, M_Light, M_Shadow,
M_Spirit, M_Water, M_Fire, M_Forest);
r = result;
}

char Test(bool a, bool b, bool c, bool d,
bool e, bool f, bool g, bool h)
{
char result = 0;
result += a<<7;
result += b<<6;
result += c<<5;
result += d<<4;
result += e<<3;
result += f<<2;
result += g<<1;
result += h;

return result;
}


Title: Re: MHS Thread
Post by: mzxrules on November 22, 2014, 12:50:02 AM
Code:
bool d_right[2] = {0, 0};
bool d_left[2] = {0, 0};
bool d_down[2] = {0, 0};
bool d_up[2] = {0, 0};

short locked = 0; //change to char for byte,

VOID Lock(MHS_ADDRESS aAddress, INT iItemSize)
{
    extern char b2 = { "", aAddress+0x1C84B7}; // 0x1C84B4
    extern short var = { "", aAddress+0x1DAAE4}; // 0x1DAB6C  (tunic)

if (runOnce == 1)
{
locked = var;
runOnce = 0;
}

d_right[0] = b2 & 0x01;
d_left[0]  = b2 & 0x02;
d_down[0]  = b2 & 0x04;
d_up[0]    = b2 & 0x08;

if (CheckInput(d_right))
locked++;

if (CheckInput(d_left))
locked--;

if(CheckInput(d_up))
locked += 10;

if(CheckInput(d_down))
locked -= 10;

var = locked;

d_right[1] = d_right[0];
d_left[1] = d_left[0];
d_down[1] = d_down[0];
d_up[1] = d_up[0];
}

bool CheckInput(bool* b)
{
return (b[0] && b[0] != b[1]);
}