Page 1 of 1

Resigning Map in C

Posted: Mon Apr 02, 2007 8:16 am
by timrs
How would I resign a map using C without any checks for anything -- just a simple function used to sign a halo 2 map? I am having bad luck searching these forums -- the search engine sucks...

Posted: Mon Apr 02, 2007 11:21 am
by Prey

Code: Select all

            FileStream fs = new FileStream((map.path,
                FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);

            BinaryReader br = new BinaryReader(fs);
            BinaryWriter bw = new BinaryWriter(fs);

            int sig = 0;
            long length = br.BaseStream.Length;

            br.BaseStream.Position = 2048;

            for (long i = 2048; i < length; i += 4)
                sig ^= br.ReadInt32();

            bw.BaseStream.Position = 720;
            bw.Write(sig);

            br.Close();
            bw.Close();
That is C# if it helps.

Re: Resigning Map in C

Posted: Mon Apr 02, 2007 11:22 am
by Th2mods
timrs wrote:How would I resign a map using C without any checks for anything -- just a simple function used to sign a halo 2 map? I am having bad luck searching these forums -- the search engine sucks...
i use google

Posted: Mon Apr 02, 2007 11:35 am
by timrs
Well, actually this helps me know what needs to be done, but still need help to get this into c++ -- I found ifstream, the equivelent to filestream -- and i know i need to put "#include <fstream> but not anything else---please help me, and tell me what files to include