/// <summary>Creates a new huffnode for the first entry in the grhead huffnode dictionary (array).</summary> /// <param name="grhead">The grhead structure.</param> public huffnode(grheadtype grhead) : this(grhead.Buffer, grhead.dictionary) { }
//========================================================================== /* ============================ = = LoadNearData = = Load stuff into data segment before memory manager is = started (which takes all available memory, near and far) = ============================ */ private void LoadNearData() { // // load egahead.ext (offsets and dictionary for graphics file) // string fileName = "EGAHEAD." + EXTENSION; if(!_sys.FileExists(fileName)) Quit("Can't open EGAHEAD." + EXTENSION + "!"); byte[] buffer = _sys.FileReadAllBytes(fileName); grhead = new grheadtype(buffer); if(grhead.dataoffsets + NUMCHUNKS * 4 + 3 >= grhead.Buffer.Length) { // as: CacheGrFile reads past the end of grstarts (on the last entry) // workaround - create an extra entry and add it to the end of grstarts Array.Resize<byte>(ref buffer, buffer.Length + 4); int fileLength = _sys.FileLength("EGAGRAPH." + EXTENSION); if(fileLength == -1) Quit("Cannot open EGAGRAPH." + EXTENSION + "!"); buffer[buffer.Length - 4] = (byte) fileLength; fileLength >>= 8; buffer[buffer.Length - 3] = (byte) fileLength; fileLength >>= 8; buffer[buffer.Length - 2] = (byte) fileLength; fileLength >>= 8; buffer[buffer.Length - 1] = (byte) fileLength; grhead = new grheadtype(buffer); } }