EOSERV Forum > Lounge > Question on decoding the Map name. (C++)
Topic is locked.
Page: << 1 >>
Question on decoding the Map name. (C++)
Author Message
Post #63864 Question on decoding the Map name. (C++)

I am having problems with decoding the map name. I loaded up Aeven with my clone and the name seems to be backwards and encoded. Since I know some of you guys know the encoding on this I thought why not ask here :) I have looked at Sausages map editor source but I can't find where he decodes it as all he does when loading is memcpy it :S

I don't think its been interwoven just backwards and with the bytes altered.

Ohh well, Fingers crossed someone lets me know here :)

---
I am an alien and not crazy!
14 years, 9 weeks ago
Post #63868 Re: Question on decoding the Map name. (C++)
std::string DecodeEMFString(std::string chars)

{

    reverse(chars.begin(), chars.end());



    bool flippy = (chars.length() % 2) == 1;



    for (int i = 0; i < chars.length(); ++i)

    {

        byte c = chars[i];


        if (flippy)

        {

            if (c >= 0x22 && c <= 0x4F)

                c = (byte)(0x71 - c);

            else if (c >= 0x50 && c <= 0x7E)

                c = (byte)(0xCD - c);

        }

        else

        {

            if (c >= 0x22 && c <= 0x7E)

                c = (byte)(0x9F - c);

        }



        chars[i] = c;

        flippy = !flippy;

    }



    return chars;

}



std::string EncodeEMFString(std::string chars)

{

    bool flippy = (chars.length() % 2) == 1;



    for (int i = 0; i < chars.length(); ++i)

    {

        byte c = chars[i];



        if (flippy)

        {

            if (c >= 0x22 && c <= 0x4F)

                c = (byte)(0x71 - c);

            else if (c >= 0x50 && c <= 0x7E)

                c = (byte)(0xCD - c);

        }

        else

        {

            if (c >= 0x22 && c <= 0x7E)

                c = (byte)(0x9F - c);

        }



        chars[i] = c;

        flippy = !flippy;

    }



    reverse(chars.begin(), chars.end());



    return chars;

}

Thanks to Sausage for helping me with this.
14 years, 9 weeks ago
Post #63869 Re: Question on decoding the Map name. (C++)

Thanks Kenobi :) Now I can carry on with my clone :P

---
I am an alien and not crazy!
14 years, 9 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > Lounge > Question on decoding the Map name. (C++)