[Release]Pathfinder Open Source

11/24/2010 09:45 funhacker#1
Yes as you see this is now open source. Meaning NO one can make money using this code in ANY way. It's a 100% free. All I ask is you give credits to those that deserve it!

Reason for me being so nice is people (mostly Hio77) are actually doing something and willing to share! So I am now giving out the ByteMap Encryption keys and even the source code to my pathfinder app I made. Be aware I coded this a long time ago and rushed it. I know it's not perfect. I will be updating it later on for use with my ACME BO project so expect an updated cleaner and more stable source soon.

Files attached are
Pathfinder Decryptor Solution (c# 2008 Express edition)
--------------------------------------------------------
Full source code no comments sorry I will re do this at some point.


MapDestination.dat Encryption Byte Map (xlsx, Excel 2008 spreadsheet)
----------------------------------------------------------------------
Byte Map with Encryption keys to show the structure of the MapDestination.dat



Lastly,
ENJOY!



Update [01-12-2010]
---------------------

Made a working Limited Pathfinder Editor. I will be adding features of add path delete path and so forth. But for now there is a basic "Change" path option for editing already existing paths within the MapDestination.dat file.

Click the path you wish to edit -> Click the Change Button -> Make the changes -> Click Apply (or enter) to save the changes or Click Cancel (Escape) to cancel the changes.

After changes are made save the file.

Everything has a comment and explanation of what it's used for and it's purpose and what the code is attempting to accomplish.

Should also note that the source codes and apps posted here are not allowed on any site yet and if so I change my mind I will post here and in the updated source codes that I have.
11/24/2010 09:56 track19#2
how to use it
11/24/2010 12:13 kyushiro#3
nice release funhacker thanks for the updates cheers!
11/25/2010 00:57 Jack Sparrow#4
Nice release keep it up
11/25/2010 09:37 hio77#5
awesome release :)

btw i see what you meant by byte maps now, mine are more text based lol
11/25/2010 18:33 funhacker#6
Quote:
Originally Posted by hio77 View Post
awesome release :)

btw i see what you meant by byte maps now, mine are more text based lol
Byte maps of mine look more pretty and easy to understand imo :)

Here is an update I have been working on this app. Created a class which is well on it's way. Here's it's code so far for those interested in comments :D

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace Pathfinder_Editor_Project
{
    public class MapDestination
    {
        #region Public Variables
        public MapData[] Data;
        #endregion

        #region Private Variables
        ///////////////////////
        // Private Variables //
        ///////////////////////
        private int[] encryptionKeys;
        private const int NameLength = 255;
        private const int DescriptionLength = 257;
        private const int PathLength = 532;
        #endregion

            public MapDestination()
            {
                //Initialisation Code for MapData structure

                //Setup the encryption key array
                encryptionKeys = new int[27] 
                { 0xA1, 0xEF, 0xC4, 0xA7, 0xA1, 0xEF, 0xD3, 0xF2, 0xA1, 0xEF, 0xCD, 0xBB, 0xA1, 0xEF, 0xC6,
                    0xC6, 0xA1, 0xEF, 0x31, 0x30, 0x30, 0xA1, 0xEF, 0xCD, 0xF2, 0xA1, 0xEF };



            }

            public void LoadFile(string FileName)
            {
                //Loads input file for the pathfinder to create mapdata

                //Declare Variables
                FileStream fs;
                BinaryReader br;
                int pathCount;
                int keyIndex = 0; //Used to track what encryption key is to be used.

                //Check file exists
                if (!File.Exists(FileName))
                {throw new Exception("File not found! (" + FileName + ")");}

                //Create filestream
                fs = new FileStream(FileName,FileMode.Open);

                //Create Binary Reader
                br = new BinaryReader(fs);

                //Get the path count
                pathCount = br.ReadInt32();

                //Check length of file
                if (fs.Length < pathCount * PathLength + 4)
                {throw new Exception("File not large enough!");}

                //Setup MapData array
                Data = new MapData[pathCount];

                //Loopthrough and get all the data from the file.
                for (int pathIndex = 0; pathIndex < pathCount; pathIndex++)
                {
                    //Check if the keyindex is at it's limit
                    if (keyIndex == encryptionKeys.Length)
                    { keyIndex = 0; }

                    //Initialise the Path's Name and Description
                    Data[pathIndex].Name = string.Empty;
                    Data[pathIndex].Description = string.Empty;

                    //Get all the characters of the name and decrypt it
                    //using the current encryption key
                    for (int charIndex = 0; charIndex < NameLength; charIndex++)
                    {
                        Data[pathIndex].Name +=
                            Convert.ToChar(
                                br.ReadByte() ^ encryptionKeys[keyIndex]);
                    }

                    //Get all the characters of the description and decrypt it
                    //using the current encryption key
                    for (int charIndex = 0; charIndex < DescriptionLength; charIndex++)
                    {
                        Data[pathIndex].Description +=
                            Convert.ToChar(
                                br.ReadByte() ^ encryptionKeys[keyIndex]);
                    }

                    //Get the first byte of the MenuID and decrypt it using the current encryption key
                    Data[pathIndex].MenuID = br.ReadByte() ^ encryptionKeys[keyIndex];
                    //Get the remaining 3 bytes using any special rules required depending on current encryption key
                    if (keyIndex >= 18 && keyIndex <= 20)
                    {
                        Data[pathIndex].MenuID += br.ReadByte() * 256;
                        Data[pathIndex].MenuID += br.ReadByte() * 65536;
                        Data[pathIndex].MenuID += br.ReadByte() * 16777216;
                    }
                    else
                    {
                        Data[pathIndex].MenuID += (br.ReadByte() ^ 0xFF) * 256;
                        Data[pathIndex].MenuID += (br.ReadByte() ^ 0xFF) * 65536;
                        Data[pathIndex].MenuID += (br.ReadByte() ^ 0xFF) * 16777216;
                    }

                    //Get the first byte of the X position and decrypt it using the current encryption key
                    Data[pathIndex].PosX = br.ReadByte() ^ encryptionKeys[keyIndex];
                    //Get the remaining 3 bytes using any special rules required depending on current encryption key
                    if (keyIndex >= 18 && keyIndex <= 20)
                    {
                        Data[pathIndex].PosX += br.ReadByte() * 256;
                        Data[pathIndex].PosX += br.ReadByte() * 65536;
                        Data[pathIndex].PosX += br.ReadByte() * 16777216;
                    }
                    else
                    {
                        Data[pathIndex].PosX += (br.ReadByte() ^ 0xFF) * 256;
                        Data[pathIndex].PosX += (br.ReadByte() ^ 0xFF) * 65536;
                        Data[pathIndex].PosX += (br.ReadByte() ^ 0xFF) * 16777216;
                    }

                    //Get the first byte of the Y position and decrypt it using the current encryption key
                    Data[pathIndex].PosY = br.ReadByte() ^ encryptionKeys[keyIndex];
                    //Get the remaining 3 bytes using any special rules required depending on current encryption key
                    if (keyIndex >= 18 && keyIndex <= 20)
                    {
                        Data[pathIndex].PosY += br.ReadByte() * 256;
                        Data[pathIndex].PosY += br.ReadByte() * 65536;
                        Data[pathIndex].PosY += br.ReadByte() * 16777216;
                    }
                    else
                    {
                        Data[pathIndex].PosY += (br.ReadByte() ^ 0xFF) * 256;
                        Data[pathIndex].PosY += (br.ReadByte() ^ 0xFF) * 65536;
                        Data[pathIndex].PosY += (br.ReadByte() ^ 0xFF) * 16777216;
                    }

                    //Get the first byte of the parent ID and decrypt it using the current encryption key
                    Data[pathIndex].ParentID = br.ReadByte() ^ encryptionKeys[keyIndex];
                    //Get the remaining 3 bytes using any special rules required depending on current encryption key
                    if (keyIndex >= 18 && keyIndex <= 20)
                    {
                        Data[pathIndex].ParentID += br.ReadByte() * 256;
                        Data[pathIndex].ParentID += br.ReadByte() * 65536;
                        Data[pathIndex].ParentID += br.ReadByte() * 16777216;
                    }
                    else
                    {
                        Data[pathIndex].ParentID += (br.ReadByte() ^ 0xFF) * 256;
                        Data[pathIndex].ParentID += (br.ReadByte() ^ 0xFF) * 65536;
                        Data[pathIndex].ParentID += (br.ReadByte() ^ 0xFF) * 16777216;
                    }

                    //Get the first byte of the map ID and decrypt it using the current encryption key
                    Data[pathIndex].MapID = br.ReadByte() ^ encryptionKeys[keyIndex];
                    //Get the remaining 3 bytes using any special rules required depending on current encryption key
                    if (keyIndex >= 18 && keyIndex <= 20)
                    {
                        Data[pathIndex].MapID += br.ReadByte() * 256;
                        Data[pathIndex].MapID += br.ReadByte() * 65536;
                        Data[pathIndex].MapID += br.ReadByte() * 16777216;
                    }
                    else
                    {
                        Data[pathIndex].MapID += (br.ReadByte() ^ 0xFF) * 256;
                        Data[pathIndex].MapID += (br.ReadByte() ^ 0xFF) * 65536;
                        Data[pathIndex].MapID += (br.ReadByte() ^ 0xFF) * 16777216;
                    }

                    //Add one to the keyIndex
                    keyIndex++;

                }

                //Close the file
                fs.Close();
            }

            public string[] GetNameList()
            {
                //Declare Variables
                string[] result = new string[Data.Length];
                int nullIndex;

                for (int pathIndex = 0; pathIndex < Data.Length; pathIndex++)
                {
                    //Get the index of the first null byte
                    nullIndex = Data[pathIndex].Name.IndexOf(Convert.ToChar(0x00));

                    //If the null index is greater than 0 then modify the result otherwise use the original
                    if (nullIndex > 0)
                    {
                        //Get only the data that contains a character
                        result[pathIndex] = Data[pathIndex].Name.Substring(0, nullIndex);
                    }
                    else
                    {
                        result[pathIndex] = Data[pathIndex].Name;
                    }

                    
                }

                return result;
            }

            public int[] GetMapList()
            {
                //Declare Variables
                int[] result = new int[Data.Length];

                for (int pathIndex = 0; pathIndex < Data.Length; pathIndex++)
                {
                        result[pathIndex] = Data[pathIndex].MapID;
                }

                return result;
            }

            public struct MapData
        {
            //Declare Variables
            #region Public Variables
            //////////////////////
            // Public Variables //
            //////////////////////
            public string Name;
            public string Description;
            public int MenuID;
            public int PosX;
            public int PosY;
            public int ParentID;
            public int MapID;
            public int ID;
            #endregion
        };

    }
}
11/25/2010 22:50 hio77#7
very nice :) looking a lot more clearer there
11/26/2010 17:36 funhacker#8
Another Update on this. The app is comming along quite nicely :)

Got some minor clean up code to do, then some interaction with the "TreeView" object. First time ever using one of these but it will make navigating the pathfinder much easier :D

Attached Screenshot
11/27/2010 00:03 hio77#9
Quote:
Originally Posted by funhacker View Post
Another Update on this. The app is comming along quite nicely :)

Got some minor clean up code to do, then some interaction with the "TreeView" object. First time ever using one of these but it will make navigating the pathfinder much easier :D

Attached Screenshot
much cleaner :) i started looking at the action walker that i got from loveomg or forcer (dont remember which atm lol)

looks like it dont have too much work in it so when i get stuck on my source next i might break it out and have a bit of a mess around with it :)

the other option to a tree view is a view like the action walker uses (a tree view still but it uses the map ids and branches off)


EDIT:
now that i think about it its the same lol
11/30/2010 16:54 funhacker#10
Update [01-12-2010]
---------------------

Made a working Limited Pathfinder Editor. I will be adding features of add path delete path and so forth. But for now there is a basic "Change" path option for editing already existing paths within the MapDestination.dat file.

Click the path you wish to edit -> Click the Change Button -> Make the changes -> Click Apply (or enter) to save the changes or Click Cancel (Escape) to cancel the changes.

After changes are made save the file.

Everything has a comment and explanation of what it's used for and it's purpose and what the code is attempting to accomplish.

Should also note that the source codes and apps posted here are not allowed on any site yet and if so I change my mind I will post here and in the updated source codes that I have.
11/30/2010 21:23 hio77#11
Quote:
Originally Posted by funhacker View Post
Update [01-12-2010]
---------------------

Made a working Limited Pathfinder Editor. I will be adding features of add path delete path and so forth. But for now there is a basic "Change" path option for editing already existing paths within the MapDestination.dat file.

Click the path you wish to edit -> Click the Change Button -> Make the changes -> Click Apply (or enter) to save the changes or Click Cancel (Escape) to cancel the changes.

After changes are made save the file.

Everything has a comment and explanation of what it's used for and it's purpose and what the code is attempting to accomplish.

Should also note that the source codes and apps posted here are not allowed on any site yet and if so I change my mind I will post here and in the updated source codes that I have.
new source is looking really good :)

btw sorry i stopped talking to you suddenly last night my connection is broken atm and they are doing all sorts of crap to my line to test what the problem is with it...
04/09/2020 02:10 mesobedo#12
thanks dude