Halomods Community Portal: Get String Table Offset and Length? - Halomods Community Portal

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Halo3
Get String Table Offset and Length?

#1 User is offline   Xerax 

  • Double Faggot
  • PipPipPip
  • Group: Members
  • Joined: 07-May 11
  • LocationLondon, UK

  Posted 03 July 2011 - 12:59 AM

How would I go about getting thr String Table Length and Offset, from the .Map file? I'm looking though Alteration, but Detox's code confuses me alot.

Currently I have;
        public static byte[] getStringTable(EndianIO input)
        {
            try
            {
                input.Writer.BaseStream.Position = 352;
                int stringTableIndexOffset = input.Reader.ReadInt32();

                int magic = stringTableIndexOffset - 12288;

                input.Writer.BaseStream.Position = 356;
                int stringTableOffset = input.Reader.ReadInt32();
                stringTableOffset -= magic;

                input.Writer.BaseStream.Position = 348;
                int stringTableSize = input.Reader.ReadInt32();

                input.Writer.BaseStream.Position = stringTableOffset;
                byte[] stringTable = input.Reader.ReadBytes(stringTableSize);

                return stringTable;
            }
            catch (Exception ex)
            {
                return null;
            }
        }

Is that the correct way to get the stringTableOffset and Size?


Edit: This works :D. Now to work on locale Tables.

This post has been edited by Xerax: 03 July 2011 - 02:31 AM


#2 User is offline   kornman00 

  • SourceGuy 2.0
  • Group: Administrators
  • Joined: 15-November 01


Users Awards

Posted 03 July 2011 - 05:12 AM

BlamLib's Halo3 cache file code. Header reading code begins at line 141. You'll probably also want to reference this.

Edit: oh, didn't see your edit. Well, last I recall, they didn't do any real changes to the way they store the multilingual string list's data in the cache from Halo2 to Halo3. BlamLib can read (and extract) multilingual string tags, but I don't think I ever implemented it for Halo3, but it'd be pretty simple.

This post has been edited by kornman00: 03 July 2011 - 05:20 AM


#3 User is offline   Xerax 

  • Double Faggot
  • PipPipPip
  • Group: Members
  • Joined: 07-May 11
  • LocationLondon, UK

Posted 03 July 2011 - 12:33 PM

Alright, thanks for that. I'll have a look at BlamLib :). I other question, just to check if my project will even work.

I'm making a Map Patcher for Halo 3/Reach. But if you edit the string table/locale table, Patches won't work due to the maps not being the same. So, My idea was;

1) Open the modified map, get thje string and locale table and store them in 2 diffrent Byte Arrays
2) Write them into the Clean map (in a temp directory)
3) Get a patch by comparing the modified and clean map
4) Write into the patch file -> The Patch (compressed), The String Table (compressed), The Locale Table (compressed)
5) Then on the other end Write the String and Locale Table into the Map too be patched, and then apply the patch at the beginning of the patch file.

Is that a good idea?

#4 User is offline   kornman00 

  • SourceGuy 2.0
  • Group: Administrators
  • Joined: 15-November 01


Users Awards

Posted 03 July 2011 - 11:34 PM

Personally, if I was implementing a bin-diff feature into a program, I'd probably just use a third party program/library. I'd try to find one which allows you to specify the file offsets manually or at least offsets it should ignore. Then you don't have to worry about cache header differences, or encrypted locale strings.

#5 User is offline   Xerax 

  • Double Faggot
  • PipPipPip
  • Group: Members
  • Joined: 07-May 11
  • LocationLondon, UK

Posted 04 July 2011 - 01:38 PM

View Postkornman00, on 03 July 2011 - 11:34 PM, said:

Personally, if I was implementing a bin-diff feature into a program, I'd probably just use a third party program/library. I'd try to find one which allows you to specify the file offsets manually or at least offsets it should ignore. Then you don't have to worry about cache header differences, or encrypted locale strings.

I just found out, that Alteration/Ascention can infact cope with string length changes, and It was just me that heard wrong. Pitty really, I just got the application to create and apply perfectly when I found out. :x

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic