Code Snippets

View previous topic View next topic Go down

Code Snippets

Post by Phaz on Wed Jun 11, 2014 12:31 am

Occasionally I have to write some snippets of code that might be useful for others doing AO development. Here are a few:


How to get the path to your prefs folder in AppData including the "random" string of 8 characters by providing the path to AnarchyOnline.exe. For example, "C:\Funcom\Anarchy Online\AnarchyOnline.exe" will produce "C:\Users\Phaz\AppData\Local\Funcom\Anarchy Online\70dad3e6\Anarchy Online".

Code:

static string GetAoDataPath(string ExecutablePath)
{
    string ParentName = Directory.GetParent(ExecutablePath).Name;
    ExecutablePath = System.IO.Directory.GetParent(System.IO.Directory.GetParent(ExecutablePath).FullName).FullName.Replace('\\', '/');

    byte[] PathBytes = new byte[ExecutablePath.Length * sizeof(char)];
    Buffer.BlockCopy(ExecutablePath.ToCharArray(), 0, PathBytes, 0, PathBytes.Length);

    uint ESI, EAX, EDI;
    ESI = EAX = EDI = 0;

    for (int EDX = 0; EDX < ExecutablePath.Length; EDX++)
    {
        ESI = EAX;
        ESI = ESI << 6;
        EDI = EAX;
        EDI = EDI >> 2;
        ESI += EDI;
        EDI = ExecutablePath[EDX];
        ESI = ESI + EDI + 0x9E3779B9;
        EAX = EAX ^ ESI;
    }
    return Path.Combine(new string[] { Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Funcom", "Anarchy Online", EAX.ToString("x"), ParentName });
}


This isn't really a code snippet but some people might enjoy it. You can bypass the AO launcher by creating a shortcut directly to AnarchyOnline.exe and it will work as long as you provide the command line arguments. I'm not sure what the third parameter (DU) is supposed to be but it seems that it can be excluded.

Code:

"C:\Funcom\Anarchy Online\AnarchyOnline.exe" IA700453413 IP7505 DU

_________________
Your actions include but are not limited to:

Abuse of Game Mechanics
Trivializing boss encounters
Use of 3rd party programs that violate the EULA
Customer service abuse
Posting of exploit information on the Anarchy Online Public Forums
Use and direction of known exploits
avatar
Phaz
Supreme Overlord
Supreme Overlord

Posts : 69
Join date : 2013-04-29

View user profile http://phaz-online.com

Back to top Go down

Re: Code Snippets

Post by Sixxfeetundr on Tue Dec 13, 2016 2:00 pm

Interesting that the second parameter is "IP7505". Perhaps "IP" is a static variable in the program containing the server IP to connect to and 7505 is the port.

Sixxfeetundr

Posts : 9
Join date : 2013-08-16
Age : 20
Location : West Grove, PA

View user profile

Back to top Go down

Re: Code Snippets

Post by Phaz on Tue Dec 13, 2016 2:11 pm

IA is Internet address followed by the integer value of the IP address, and IP is Internet port, which is the port used for the logon server.

_________________
Your actions include but are not limited to:

Abuse of Game Mechanics
Trivializing boss encounters
Use of 3rd party programs that violate the EULA
Customer service abuse
Posting of exploit information on the Anarchy Online Public Forums
Use and direction of known exploits
avatar
Phaz
Supreme Overlord
Supreme Overlord

Posts : 69
Join date : 2013-04-29

View user profile http://phaz-online.com

Back to top Go down

Re: Code Snippets

Post by Sixxfeetundr on Tue Dec 13, 2016 11:49 pm

That makes sense. I know 7505 is used during login, that's what got my idea. That IA can't be right though, that correlates to a server in Africa and FC uses that gamehosting company in NJ right?

Sixxfeetundr

Posts : 9
Join date : 2013-08-16
Age : 20
Location : West Grove, PA

View user profile

Back to top Go down

Re: Code Snippets

Post by Sixxfeetundr on Tue Dec 13, 2016 11:52 pm

Also, would it be possible to connect to private servers without changing the launcher config file by adjusting those values appropriately?

Sixxfeetundr

Posts : 9
Join date : 2013-08-16
Age : 20
Location : West Grove, PA

View user profile

Back to top Go down

Re: Code Snippets

Post by Phaz on Wed Dec 14, 2016 12:19 am

Let's break it down shall we? If we convert 700453413 to hex we get 29C01225. As an ipv4 address is 4 bytes, one for each octet, this leaves us with 29.C0.12.25, or 41.192.18.37. The byte ordering has been reversed, so if we reverse it back we get 37.18.192.41, which is indeed AO's login server.

You can indeed use this method to connect to a private server by following the steps I just went through in reverse. Hope this helps.

_________________
Your actions include but are not limited to:

Abuse of Game Mechanics
Trivializing boss encounters
Use of 3rd party programs that violate the EULA
Customer service abuse
Posting of exploit information on the Anarchy Online Public Forums
Use and direction of known exploits
avatar
Phaz
Supreme Overlord
Supreme Overlord

Posts : 69
Join date : 2013-04-29

View user profile http://phaz-online.com

Back to top Go down

Re: Code Snippets

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum