Beispiel #1
0
void    real(void)
{
    u32     x;
    u32     y;
    u32     reg0;
    u32     reg1;
    u32     offset;
    int     input;

    if (is_pressed(BUTTON_R + BUTTON_DD))
    {
        x = READU32(g_world_x);
        y = READU32(g_world_y);
        if (x >= 0x10 && y >= 0x10)
        {
            x -= 0x10;
            y -= 0x10;
            reg0 = x % 0x10;
            x /= 0x10;
            reg1 = y % 0x10;
            y /= 0x10;
            reg0 *= 0x4;
            reg1 *= 0x40;
            x *= 0x400;
            y *= 0x1400;
            offset = reg0 + reg1 + x + y;           
            get_input_id(&input, NULL);
            WRITEU16(g_town_items + offset, input);
        }
    }   
}
Beispiel #2
0
void	moonjump_jap(void)
{
	int		loc;
	u32		Z;

    if (!(any_is_pressed(R)) && is_pressed(BUTTON_L)) //it's better to test the negation first
	{
		loc = READU32(0x17321644);
		Z = READU32(0x17321514);
		if (Z >= 0x440F0000)
		{
			if (loc == -1)
			{
				WRITEU32(0x17321514, 0x440F0000);
			}
			else
			{
				WRITEU32(0x17321640, 0x440F0000);
			}
		}
		else
		{
			if (loc == -1)
			{
				ADDTOFLOAT(0x17321514, 0x00000006);
			}
			else
			{
				ADDTOFLOAT(0x17321640, 0x00000006);
			}
		}	
	}
}
Beispiel #3
0
void    moonjump(void)
{
    int     loc;
    u32     height;

    if (!(any_is_pressed(R)) && is_pressed(BUTTON_L)) //it's better to test the negation first
    {
        loc = READU32(g_location);
        height = READU32(g_outdoor_pos_y);
        if (height >= 0x440F0000)
        {
            if (loc == -1)
            {
                WRITEU32(g_outdoor_pos_y, 0x440F0000);
            }
            else
            {
                WRITEU32(g_indoor_pos_y, 0x440F0000);
            }
        }
        else
        {
            if (loc == -1)
            {
                ADDTOFLOAT(g_outdoor_pos_y, 6.0);
            }
            else
            {
                ADDTOFLOAT(g_indoor_pos_y, 6.0);
            }
        }   
    }
}
Beispiel #4
0
u32     readSlot(int slot)
{
    u32     offset;

    offset = READU32(g_player_ptr);
    if (offset != 0)
        return (READU32(offset + 0x6BD0 + (slot * 4)));
}
Beispiel #5
0
void    teleport(void)
{
    static u32    indoor_X[3] = { 0 };
    static u32    indoor_Y[3] = { 0 };
    static u32    outdoor_X[3] = { 0 };
    static u32    outdoor_Y[3] = { 0 };
    int           loc;
    int           slot;

    if (!is_pressed(BUTTON_B) && !g_text_activated)
        return;

    //Pointer to define whether player is indoors or not
    loc = READU32(g_location);
    if (is_pressed(BUTTON_L)) //If L is pressed then use slot3
        slot = 2;
    else if (is_pressed(BUTTON_R)) //If R is pressed then use slot2
        slot = 1;
    else //If noting is pressed then use slot0
        slot = 0;
    if (is_pressed(BUTTON_B + BUTTON_DU)
        || (g_teleport_save && g_text_activated))
    {       
        if (loc == -1) 
        {           
            outdoor_X[slot] = READU32(g_outdoor_pos_x);
            outdoor_Y[slot] = READU32(g_outdoor_pos_z);
        }
        else
        {
            indoor_X[slot] = READU32(g_indoor_pos_x);
            indoor_Y[slot] = READU32(g_indoor_pos_z);
        }
    }
    else if (is_pressed(BUTTON_B + BUTTON_DD)
             || (!g_teleport_save && g_text_activated))
    {
        if (loc == -1)
        {
            WRITEU32(g_outdoor_pos_x, outdoor_X[slot]);
            WRITEU32(g_outdoor_pos_z, outdoor_Y[slot]);
        }
        else
        {
            WRITEU32(g_indoor_pos_x, indoor_X[slot]);
            WRITEU32(g_indoor_pos_z, indoor_Y[slot]);
        }
    }
}
Beispiel #6
0
void    coord(void)
{
    static int  loc = 0;

    if (!is_pressed(BUTTON_A))
        return;
    loc = READU32(g_location);
    if (loc == -1) //FFFFFFFF=outdoors
    {
        if (is_pressed(BUTTON_A + BUTTON_DD))
            ADDTOFLOAT(g_outdoor_pos_x, 1.0);
        if (is_pressed(BUTTON_A + BUTTON_DU))
            SUBTOFLOAT(g_outdoor_pos_x, 1.0);
        if (is_pressed(BUTTON_A + BUTTON_DL))
            SUBTOFLOAT(g_outdoor_pos_z, 1.0);
        if (is_pressed(BUTTON_A + BUTTON_DR))
            ADDTOFLOAT(g_outdoor_pos_z, 1.0);
    }
    else //if it's anything but FFFFFFFF then you're indoors
    {
        if (is_pressed(BUTTON_A + BUTTON_DD))
            ADDTOFLOAT(g_indoor_pos_x, 1.0);
        if (is_pressed(BUTTON_A + BUTTON_DU))
            SUBTOFLOAT(g_indoor_pos_x, 1.0);
        if (is_pressed(BUTTON_A + BUTTON_DL))
            SUBTOFLOAT(g_indoor_pos_z, 1.0);
        if (is_pressed(BUTTON_A + BUTTON_DR))
            ADDTOFLOAT(g_indoor_pos_z, 1.0);
    }
}
Beispiel #7
0
void    coord_jap(void)//JAP
{
    static int           loc = 0;

    if (is_pressed(BUTTON_A))
    {
        loc = READU32(0x173B8CC4); //JP
    }
    if (loc == -1) //FFFFFFFF=outdoors
    {
        if (is_pressed(BUTTON_A + BUTTON_DD))
            ADDTOFLOAT(0x173B8B98, 0x00000002); //JP
        if (is_pressed(BUTTON_A + BUTTON_DU))
            SUBTOFLOAT(0x173B8B98, 0x00000002); //JP
        if (is_pressed(BUTTON_A + BUTTON_DL))
            SUBTOFLOAT(0x173B8B90, 0x00000002); //JP
        if (is_pressed(BUTTON_A + BUTTON_DR))
            ADDTOFLOAT(0x173B8B90, 0x00000002); //JP
    }
    else //if it's anything but FFFFFFFF then you're indoors
    {
        if (is_pressed(BUTTON_A + BUTTON_DD))
            ADDTOFLOAT(0x173B8CC4, 0x00000002); //JP
        if (is_pressed(BUTTON_A + BUTTON_DU))
            SUBTOFLOAT(0x173B8CC4, 0x00000002); //JP
        if (is_pressed(BUTTON_A + BUTTON_DL))
            SUBTOFLOAT(0x173B8CBC, 0x00000002); //JP
        if (is_pressed(BUTTON_A + BUTTON_DR))
            ADDTOFLOAT(0x173B8CBC, 0x00000002); //JP
    }
}
Beispiel #8
0
void    writePlayer(u32 offset, u32 data)
{
    u32     address;
    
    address = READU32(g_player_ptr);
    WRITEU32(address + offset, data);  
}
Beispiel #9
0
void    writeSlot(int slot, u32 item)
{
    u32     offset;
    
    offset = READU32(g_player_ptr);
    if (offset != 0 && item > 0x1000 && (item < 0x4000 || item == 0x7FFE))
    {
        WRITEU32(offset + 0x6BD0 + (slot * 4), item);
    }  
}
Beispiel #10
0
void	duplicate4_jap(void)//JAP
{
	u32			dupe = 0;
	u32			dupe0 = 0;
	u32			dupe1 = 0;
	u32			dupe2 = 0;
	u32			dupe3 = 0;
	u32			dupe4 = 0;
	
	if (is_pressed(BUTTON_R))
	{
		dupe = READU32(0x16074000);
		dupe0 = READU32(0xAEEC28); //online pointer0
		dupe1 = READU32(0xAF8B38); //online pointer1
		dupe2 = READU32(0xB02A48); //online pointer2
		dupe3 = READU32(0xB0C958);
		dupe4 = READU32(0xB0BA58);
		WRITEU32(0x16074004, dupe);
		WRITEU32(0xAEEC2C, dupe0);
		WRITEU32(0xAF8B3C, dupe1);
		WRITEU32(0xB02A4C, dupe2);	
		WRITEU32(0xB0C96C, dupe3);
		WRITEU32(0xB0BA6C, dupe4);
	}
}
Beispiel #11
0
void    speed(void)
{
    u32     velocity;

    if (is_pressed(BUTTON_B))
    {
        velocity = READU32(g_velocity);
        if (velocity >= 0x41A79DB3)
        {
            WRITEU32(g_velocity, 0x41A79DB3);
        }
        else if (velocity > 0)
        {
            ADDTOFLOAT(g_velocity, 2.0);
        }
    }
}
Beispiel #12
0
void	speed_jap(void) //JAP
{
	u32			  velocity;

	if (is_pressed(BUTTON_B))
	{
		velocity = READU32(0x173B8BBC);
		if (velocity >= 0x41A79DB3)
		{
			WRITEU32(0x173B8BBC, 0x41A79DB3);
		}
		else if (velocity > 0)
		{
			add_to_address((void*)0x173B8BBC, 0x00000002);
		}
	}
}
Beispiel #13
0
void    duplicate(void)
{
    
 //   u32 dupe0 = 0;
 //   u32 dupe1 = 0;
 //   u32 dupe2 = 0;
 //   u32 dupe3 = 0;
 //   u32 dupe4 = 0;
 //   u32 dupe5 = 0;
    u32     dupe = 0;
    u32     offset;
    u8      player;
    /* OFFSETS FOUND 
    ** 0xAAb0e0 only player on island.
    ** 0xA8C360 2nd player on island.
    ** 0xAA0C60 3rd player on island.        
    */   
    if (is_pressed(BUTTON_R))
    {
        player = READU8(g_player);
        // Player 4 should be the highest value stored here. 
        // It goes to 0x7 when visiting a dream and someone's town I think?
        if (player <= 0x3)
        {
            offset = player * 0xA480;
        }
        dupe = READU32(g_inv + offset);
        //dupe0 = READU32(0xAB36E0); //online pointer0
        //dupe1 = READU32(0xABDB60); //online pointer1
        //dupe2 = READU32(0xAC7FE0); //online pointer2
        //dupe3 = READU32(0xAAb0e0);
        //dupe4 = READU32(0xA8C360);
        //dupe5 = READU32(0xAA0C60);
        WRITEU32(g_inv + offset + 0x4, dupe);
        //WRITEU32(0xAB36E4, dupe0); //player 2
        //WRITEU32(0xABDB64, dupe1); //player 3
        //WRITEU32(0xAC7FE4, dupe2); //player 4
        //WRITEU32(0xAAb0e4, dupe3);
        //WRITEU32(0xA8C364, dupe4);
        //WRITEU32(0xAA0C64, dupe5);
    }
}
Beispiel #14
0
void extract_strings(uint8_t * buffer, size_t len)
{
	size_t off = 0;
	int i;
	uint16_t id;
	uint32_t l;
	char lang[8];
	char fname[32];
	FILE * f;
	while((off = find_word(buffer, locl, off, len)) < len) {
/*
002e3c4c: 4c4f434c		LOCL long word
002e3c50: 00000000
002e3c54: 00010000		???
002e3c58: 002e3c4c LOCL
002e3c5c: 002e3c04 (C) Copyright Hewlett-Packard Company 1987-1994. All Rights Reserved.
002e3c60: 01309572		???
002e3c64: 00000101		???
002e3c68: 002e7c84 en
002e3c6c: 002e7c87 US
002e3c70: 000007d4		? sometimes 00000005 or 0000000C (tr-TR)
002e3c74: adf80000		string id (word)
002e3c78: 002e7c8c Insert memory card
*/
		if((READU32((buffer+off+4))) == 0) {
			for(i = 0; i < 64; i += 4) {
				l = READU32((buffer+off+i));
				printf("%08lx: %08x", off+i, l);
				if(l > 0x10000 && l < len) printf(" %s", buffer + l);
				printf("\n");
			}
			snprintf(lang, sizeof(lang), "%s-%s",
			         buffer + (READU32((buffer+off+0x1C))),
			         buffer + (READU32((buffer+off+0x20))));
			/*n = READU32((buffer+off+0x24));*/
			/*printf("%s : %d strings\n", lang, n);*/
			snprintf(fname, sizeof(fname), "strings.%s", lang);
			f = fopen(fname, "w");
			for(i = 0; /*i < n*/; i++) {
				id = READU16((buffer+off+0x28+i*8)); 
				if(id == 0 || READU16((buffer+off+0x28+i*8+2)) != 0) break;
				l = READU32((buffer+off+0x28+i*8+4));
				fprintf(f, "%04X (=%d):\n%s\n\n", id, id, buffer + l);
			}
			fclose(f);
			printf("\n");
		} else {
			printf("%08lx : LOCL\n", off);
		}
		off += 4;
	}
	off = 0;
	while((off = find_word(buffer, locm, off, len)) < len) {
		if((READU32((buffer+off+8))) == 0x00010000) {
			for(i = 0; i < 64; i += 4) {
				l = READU32((buffer+off+i));
				printf("%08lx: %08x", off+i, l);
				if(l > 0x10000 && l < len) printf(" %s", buffer + l);
				printf("\n");
			}
			snprintf(fname, sizeof(fname), "strings.LOCM_%06lX%s", off);
			f = fopen(fname, "w");
			for(i = 0; /*i < n*/; i++) {
				uint16_t flags;
				id = READU16((buffer+off+0x28+i*8));
				flags = READU16((buffer+off+0x28+i*8+2));
				if(id == 0) break;
				l = READU32((buffer+off+0x28+i*8+4));
				fprintf(f, "%04X (=%d) flags=%04X :\n%s\n\n", id, id, flags, buffer + l);
			}
			fclose(f);
			printf("\n");
		} else {
			printf("%08lx LOCM\n", off);
		}
		off += 4;
	}
}
Beispiel #15
0
void    teleport_jap(void) //JAP
{
	static u32    indoor_X[3] = { 0 };
	static u32    indoor_Y[3] = { 0 };
	static u32    outdoor_X[3] = { 0 };
	static u32    outdoor_Y[3] = { 0 };
	static int    loc = 0;

	if (is_pressed(BUTTON_B)) //Pointer to define whether player is indoors or not
	{
		loc = READU32(0x173B8CC4);
	}
	if (is_pressed(BUTTON_B + BUTTON_DU))
	{
		if (loc == -1)
		{
			if (is_pressed(BUTTON_L)) //If L is pressed then save in slot3
			{
				outdoor_X[2] = READU32(0x173B8B90);
				outdoor_Y[2] = READU32(0x173B8B98);
			}
			else if (is_pressed(BUTTON_R)) //If R is pressed then save in slot2
			{
				outdoor_X[1] = READU32(0x173B8B90);
				outdoor_Y[1] = READU32(0x173B8B98);
			}
			else //If noting is pressed then save in slot0
			{
				outdoor_X[0] = READU32(0x173B8B90);
				outdoor_Y[0] = READU32(0x173B8B98);
			}
		}
		else
		{
			if (is_pressed(BUTTON_L)) //If L is pressed then save in slot3
			{
				indoor_X[2] = READU32(0x173B8CBC);
				indoor_Y[2] = READU32(0x173B8CC4);
			}
			else if (is_pressed(BUTTON_R)) //If R is pressed then save in slot2
			{
				indoor_X[1] = READU32(0x173B8CBC);
				indoor_Y[1] = READU32(0x173B8CC4);
			}
			else //If noting is pressed then save in slot0
			{
				indoor_X[0] = READU32(0x173B8CBC);
				indoor_Y[0] = READU32(0x173B8CC4);
			}
		}
	}
	if (is_pressed(BUTTON_B + BUTTON_DD))
	{
		loc = READU32(0x17321644);
		if (loc == -1)
		{

			if (is_pressed(BUTTON_L)) //If L is pressed then restore slot3
			{
				WRITEU32(0x173B8B90, outdoor_X[2]);
				WRITEU32(0x173B8B98, outdoor_Y[2]);
			}
			else if (is_pressed(BUTTON_R)) //If R is pressed then restore slot2
			{
				WRITEU32(0x173B8B90, outdoor_X[1]);
				WRITEU32(0x173B8B98, outdoor_Y[1]);
			}
			else //If noting is pressed then restore slot0
			{
				WRITEU32(0x173B8B90, outdoor_X[0]);
				WRITEU32(0x173B8B98, outdoor_Y[0]);
			}
		}
		else
		{
			if (is_pressed(BUTTON_L)) //If L is pressed then restore slot3
			{
				WRITEU32(0x173B8CBC, indoor_X[2]);
				WRITEU32(0x173B8CC4, indoor_Y[2]);
			}
			else if (is_pressed(BUTTON_R)) //If R is pressed then restore slot2
			{
				WRITEU32(0x173B8CBC, indoor_X[1]);
				WRITEU32(0x173B8CC4, indoor_Y[1]);
			}
			else //If noting is pressed then restore slot0
			{
				WRITEU32(0x173B8CBC, indoor_X[0]);
				WRITEU32(0x173B8CC4, indoor_Y[0]);
			}
		}
	}
}