Ejemplo n.º 1
0
        protected override void loadBlo1(aBinaryReader reader)
        {
            base.loadBlo1(reader);

            var finder = bloResourceFinder.getFinder();

            int numparams = reader.Read8();

            mFont = finder.find <bloResFont>(reader, "font");

            mTopColor    = new bloColor(reader.Read32());
            mBottomColor = new bloColor(reader.Read32());

            int binding = reader.Read8();

            mHBinding = (bloTextboxHBinding)((binding >> 2) & 3);
            mVBinding = (bloTextboxVBinding)((binding >> 0) & 3);

            mFontSpacing = reader.ReadS16();
            mFontLeading = reader.ReadS16();
            mFontWidth   = reader.Read16();
            mFontHeight  = reader.Read16();

            int strlen = reader.Read16();

            setString(reader.Read8s(strlen));

            numparams -= 10;

            if (numparams > 0)
            {
                if (reader.Read8() != 0)
                {
                    setConnectParent(true);
                }
                --numparams;
            }

            if (numparams > 0)
            {
                mFromColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mFromColor = new bloColor(bloColor.cZero);
            }

            if (numparams > 0)
            {
                mToColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mToColor = new bloColor(bloColor.cOne);
            }

            reader.Skip(4);
        }
Ejemplo n.º 2
0
        static aRGBA[] loadIA8(aBinaryReader reader, int width, int height)
        {
            var       data = new aRGBA[width * height];
            const int cBlockWidth = 4, cBlockHeight = 4;

            for (var y = 0; y < height; y += cBlockHeight)
            {
                for (var x = 0; x < width; x += cBlockWidth)
                {
                    for (var by = 0; by < cBlockHeight; ++by)
                    {
                        for (var bx = 0; bx < cBlockWidth; ++bx)
                        {
                            var intensity = reader.Read8();
                            var alpha     = reader.Read8();
                            if ((bx + x) >= width || (by + y) >= height)
                            {
                                continue;
                            }
                            data[width * (y + by) + (x + bx)] = new aRGBA(intensity, alpha);
                        }
                    }
                }
            }
            return(data);
        }
Ejemplo n.º 3
0
        protected override void loadCompact(aBinaryReader reader)
        {
            base.loadCompact(reader);

            var finder = bloResourceFinder.getFinder();

            mTextureCount = 1;
            mTextures[0]  = finder.find <bloTexture>(reader, "timg");
            mPalette      = finder.find <bloPalette>(reader, "tlut");

            mBinding = (bloBinding)reader.Read8();

            int bits = reader.Read8();

            mMirror   = (bloMirror)((bits >> 0) & 3);
            mRotate90 = ((bits & 4) != 0);
            mWrapS    = (bloWrapMode)((bits >> 3) & 3);
            mWrapT    = mWrapS;

            reader.Skip(4);

            for (int i = 0; i < 4; ++i)
            {
                mColors[i] = new bloColor(bloColor.cWhite);
            }

            setBlendKonstColor();
            setBlendKonstAlpha();
        }
Ejemplo n.º 4
0
 void loadPaletteDataIA8(aBinaryReader reader)
 {
     for (int i = 0; i < mEntryCount; ++i)
     {
         var i8 = reader.Read8();
         var a8 = reader.Read8();
         mData[i] = new aRGBA(i8, a8);
     }
 }
Ejemplo n.º 5
0
        public override void load(Stream stream)
        {
            var reader = new aBinaryReader(stream, Endianness.Big);

            reader.PushAnchor();
            mFormat       = (gxTlutFormat)reader.Read8();
            mTransparency = reader.Read8();
            mEntryCount   = reader.Read16();
            reader.Goto(0x20);
            loadPaletteData(reader);
        }
Ejemplo n.º 6
0
        public T find <T>(aBinaryReader reader, string directory, out bloResourceType type)
            where T : bloResource, new()
        {
            type = (bloResourceType)reader.Read8();
            int    length   = reader.Read8();
            string name     = reader.ReadString(length);
            T      resource = find <T>(type, name, directory);

            if (resource == null && type != bloResourceType.None)
            {
                Console.WriteLine(">>> FAILED: could not find {0} resource '{1}'", type, name);
            }
            return(resource);
        }
Ejemplo n.º 7
0
        public static int Read24(this aBinaryReader reader)
        {
            var byte1 = reader.Read8();
            var byte2 = reader.Read8();
            var byte3 = reader.Read8();

            if (reader.Endianness == Endianness.Big)
            {
                return((byte1 << 16) | (byte2 << 8) | byte3);
            }
            else
            {
                return((byte3 << 16) | (byte2 << 8) | byte1);
            }
        }
Ejemplo n.º 8
0
        static aRGBA[] loadI4(aBinaryReader reader, int width, int height)
        {
            var       data = new aRGBA[width * height];
            const int cBlockWidth = 8, cBlockHeight = 8;

            for (var y = 0; y < height; y += cBlockHeight)
            {
                for (var x = 0; x < width; x += cBlockWidth)
                {
                    for (var by = 0; by < cBlockHeight; ++by)
                    {
                        for (var bx = 0; bx < cBlockWidth; bx += 2)
                        {
                            var i4    = reader.Read8();
                            var index = (width * (y + by) + (x + bx));
                            if ((by + y) >= height)
                            {
                                continue;
                            }
                            if ((bx + x) < width)
                            {
                                data[index] = new aRGBA(sNybbleToByte[(i4 >> 4) & 0xF]);
                            }
                            if ((bx + x + 1) < width)
                            {
                                data[index + 1] = new aRGBA(sNybbleToByte[i4 & 0xF]);
                            }
                        }
                    }
                }
            }
            return(data);
        }
Ejemplo n.º 9
0
        static short[] loadCI8(aBinaryReader reader, int width, int height)
        {
            var       data = new short[width * height];
            const int cBlockWidth = 8, cBlockHeight = 4;

            for (var y = 0; y < height; y += cBlockHeight)
            {
                for (var x = 0; x < width; x += cBlockWidth)
                {
                    for (var by = 0; by < cBlockHeight; ++by)
                    {
                        for (var bx = 0; bx < cBlockWidth; ++bx)
                        {
                            var ci8 = reader.Read8();
                            if ((bx + x) >= width || (by + y) >= height)
                            {
                                continue;
                            }
                            data[width * (y + by) + (x + bx)] = ci8;
                        }
                    }
                }
            }
            return(data);
        }
Ejemplo n.º 10
0
        static short[] loadCI4(aBinaryReader reader, int width, int height)
        {
            var       data = new short[width * height];
            const int cBlockWidth = 8, cBlockHeight = 8;

            for (var y = 0; y < height; y += cBlockHeight)
            {
                for (var x = 0; x < width; x += cBlockWidth)
                {
                    for (var by = 0; by < cBlockHeight; ++by)
                    {
                        for (var bx = 0; bx < cBlockWidth; bx += 2)
                        {
                            var ci4   = reader.Read8();
                            var index = (width * (y + by) + (x + bx));
                            if ((by + y) >= height)
                            {
                                continue;
                            }
                            if ((bx + x) < width)
                            {
                                data[index] = (short)((ci4 >> 4) & 0xF);
                            }
                            if ((bx + x + 1) < width)
                            {
                                data[index + 1] = (short)((ci4 >> 0) & 0xF);
                            }
                        }
                    }
                }
            }
            return(data);
        }
Ejemplo n.º 11
0
        static aRGBA[] loadIA4(aBinaryReader reader, int width, int height)
        {
            var       data = new aRGBA[width * height];
            const int cBlockWidth = 8, cBlockHeight = 4;

            for (var y = 0; y < height; y += cBlockHeight)
            {
                for (var x = 0; x < width; x += cBlockWidth)
                {
                    for (var by = 0; by < cBlockHeight; ++by)
                    {
                        for (var bx = 0; bx < cBlockWidth; ++bx)
                        {
                            var ia4 = reader.Read8();
                            if ((bx + x) >= width || (by + y) >= height)
                            {
                                continue;
                            }
                            data[width * (y + by) + (x + bx)] = new aRGBA(sNybbleToByte[ia4 & 0xF], sNybbleToByte[(ia4 >> 4) & 0xF]);
                        }
                    }
                }
            }
            return(data);
        }
Ejemplo n.º 12
0
        protected override void loadCompact(aBinaryReader reader)
        {
            base.loadCompact(reader);

            var finder = bloResourceFinder.getFinder();

            mFont = finder.find <bloResFont>(reader, "font");

            mTopColor    = new bloColor(reader.Read32());
            mBottomColor = new bloColor(reader.Read32());

            int hbinding = reader.Read8();

            mHBinding = (bloTextboxHBinding)(hbinding & 127);
            mVBinding = (bloTextboxVBinding)reader.Read8();

            if ((hbinding & 0x80) != 0)
            {
                mFontSpacing = reader.ReadS16();
                mFontLeading = reader.ReadS16();
                mFontWidth   = reader.Read16();
                mFontHeight  = reader.Read16();
            }
            else if (mFont != null)
            {
                mFontSpacing = 0;
                mFontLeading = mFont.getLeading();
                mFontWidth   = mFont.getWidth();
                mFontHeight  = mFont.getHeight();
            }
            else
            {
                mFontSpacing = 0;
                mFontLeading = 0;
                mFontWidth   = 0;
                mFontHeight  = 0;
            }

            int strlen = reader.Read16();

            setString(reader.Read8s(strlen));

            mFromColor = new bloColor(bloColor.cZero);
            mToColor   = new bloColor(bloColor.cOne);

            reader.Skip(4);
        }
Ejemplo n.º 13
0
        public void load(aBinaryReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            reader.PushAnchor();
            var entryCount  = reader.ReadS32();
            var fieldCount  = reader.ReadS32();
            var entryOffset = reader.Read32();
            var entrySize   = reader.ReadS32();

            mFields = new jmpField[fieldCount];
            for (var i = 0; i < fieldCount; ++i)
            {
                mFields[i].hash    = reader.Read32();
                mFields[i].bitmask = reader.Read32();
                mFields[i].start   = reader.Read16();
                mFields[i].shift   = reader.Read8();
                mFields[i].type    = (jmpValueType)reader.Read8();
            }
            mEntries = new jmpValue[entryCount, fieldCount];
            for (var entry = 0; entry < entryCount; ++entry)
            {
                for (var field = 0; field < fieldCount; ++field)
                {
                    reader.Goto(entryOffset + (entrySize * entry) + mFields[field].start);
                    switch (mFields[field].type)
                    {
                    case jmpValueType.INTEGER: mEntries[entry, field] = (int)((reader.ReadS32() & mFields[field].bitmask) >> mFields[field].shift); break;

                    case jmpValueType.FLOAT: mEntries[entry, field] = reader.ReadF32(); break;

                    case jmpValueType.STRING: mEntries[entry, field] = reader.ReadString <aCSTR>(0x20); break;
                    }
                }
            }
            reader.PopAnchor();
        }
Ejemplo n.º 14
0
        public static int ReadVLQ(this aBinaryReader reader)
        {
            var value = 0;

            for (var i = 0; i < 5; ++i)
            {
                var b = reader.Read8();
                value <<= 7;
                value  |= (b & 0x7F);

                if ((b & 0x80) == 0)
                {
                    break;
                }
            }

            return(value);
        }
Ejemplo n.º 15
0
        protected override void loadCompact(aBinaryReader reader)
        {
            base.loadCompact(reader);

            var finder = bloResourceFinder.getFinder();

            int x      = reader.Read16();
            int y      = reader.Read16();
            int width  = reader.Read16();
            int height = reader.Read16();

            mContentRect.set(x, y, (x + width), (y + height));

            for (int i = 0; i < 4; ++i)
            {
                mTextures[i].texture = finder.find <bloTexture>(reader, "timg");
            }
            mPalette = finder.find <bloPalette>(reader, "tlut");

            int bits = reader.Read8();

            for (int i = 0; i < 4; ++i)
            {
                mTextures[i].mirror = (bloMirror)((bits >> (6 - (i * 2))) & 3);
            }

            for (int i = 0; i < 4; ++i)
            {
                mTextures[i].color = new bloColor(reader.Read32());
            }

            mContentTexture = null;
            mFromColor.rgba = bloColor.cZero;
            mToColor.rgba   = bloColor.cOne;

            reader.Skip(4);
            initializeMinSize();
        }
Ejemplo n.º 16
0
        protected virtual void loadCompact(aBinaryReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            mVisible = (reader.Read8() != 0);
            reader.Step(1);

            mName = reader.Read32();

            int left   = reader.ReadS16();
            int top    = reader.ReadS16();
            int width  = reader.ReadS16();
            int height = reader.ReadS16();

            mRect.set(left, top, (left + width), (top + height));

            setBasePosition(bloAnchor.TopLeft);
            mAngle        = 0.0d;
            mAlpha        = 255;
            mInheritAlpha = true;
        }
Ejemplo n.º 17
0
        protected virtual void loadBlo1(aBinaryReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            int numparams = reader.Read8();

            mVisible = (reader.Read8() != 0);
            reader.Step(2);

            mName = reader.Read32();

            int left   = reader.ReadS16();
            int top    = reader.ReadS16();
            int width  = reader.ReadS16();
            int height = reader.ReadS16();

            mRect.set(left, top, (left + width), (top + height));

            numparams -= 6;

            if (numparams > 0)
            {
                mAngle = reader.Read16();
                --numparams;
            }
            else
            {
                mAngle = 0.0d;
            }

            if (numparams > 0)
            {
                mAnchor = (bloAnchor)reader.Read8();
                --numparams;
            }
            else
            {
                mAnchor = bloAnchor.TopLeft;
            }

            if (numparams > 0)
            {
                mAlpha = reader.Read8();
                --numparams;
            }
            else
            {
                mAlpha = 255;
            }

            if (numparams > 0)
            {
                mInheritAlpha = (reader.Read8() != 0);
                --numparams;
            }
            else
            {
                mInheritAlpha = true;
            }

            reader.Skip(4);
        }
Ejemplo n.º 18
0
 public override string Read(aBinaryReader reader)
 {
     var length = reader.Read8();
     var value = reader.ReadString(length);
     return value;
 }
Ejemplo n.º 19
0
        protected override WaveBank DoTransform(WaveBank obj)
        {
            if (obj != null)
            {
                return(obj);
            }

            mReader.Keep();
            mReader.PushAnchor();

            if (mReader.Read32() != WSYS)
            {
                mareep.WriteError("WSYS: could not find header.");
            }

            var size = mReader.ReadS32();

            mReader.Step(8);             // unused
            var winfOffset = mReader.ReadS32();
            var wbctOffset = mReader.ReadS32();

            mareep.WriteMessage("WSYS: header found, size {0:F1} KB\n", ((double)size / 1024.0d));

            var waveBank = new WaveBank();

            waveBank.Name = mName;

            mReader.Goto(winfOffset);

            if (mReader.Read32() != WINF)
            {
                mareep.WriteError("WSYS: could not find WINF at 0x{0:X6}.", winfOffset);
            }

            var waveGroupCount = mReader.ReadS32();

            if (waveGroupCount < 0)
            {
                mareep.WriteError("WSYS: bad wave-group count '{0}' in WINF.", waveGroupCount);
            }

            mareep.WriteMessage("WSYS: WINF found, {0} wave group(s).\n", waveGroupCount);

            var waveGroupOffsets = mReader.ReadS32s(waveGroupCount);

            mReader.Goto(wbctOffset);

            if (mReader.Read32() != WBCT)
            {
                mareep.WriteError("WSYS: could not find WBCT at 0x{0:X6}.", wbctOffset);
            }

            mReader.Step(4);             // unused

            var sceneCount = mReader.ReadS32();

            if (sceneCount != waveGroupCount)
            {
                mareep.WriteError("WSYS: WINF count ({0}) does not match WBCT count ({1}).", waveGroupCount, sceneCount);
            }

            var sceneOffsets = mReader.ReadS32s(sceneCount);

            for (var i = 0; i < waveGroupCount; ++i)
            {
                mReader.Goto(waveGroupOffsets[i]);

                var archiveName   = mReader.ReadString <aCSTR>(112);
                var waveInfoCount = mReader.ReadS32();

                if (waveInfoCount < 0)
                {
                    mareep.WriteError("WSYS: bad wave count '{0}' in wave group #{1}.", waveInfoCount, i);
                }

                var waveInfoOffsets = mReader.ReadS32s(waveInfoCount);

                mReader.Goto(sceneOffsets[i]);

                if (mReader.Read32() != SCNE)
                {
                    mareep.WriteError("WSYS: could not find SCNE at 0x{0:X6}.", sceneOffsets[i]);
                }

                mReader.Step(8);                 // unused
                var cdfOffset = mReader.ReadS32();
                mReader.Goto(cdfOffset);

                if (mReader.Read32() != C_DF)
                {
                    mareep.WriteError("WSYS: could not find C-DF at 0x{0:X6}.", cdfOffset);
                }

                var waveidCount = mReader.ReadS32();

                if (waveidCount != waveInfoCount)
                {
                    mareep.WriteError("WSYS: C-DF count ({0}) does not match wave-info count ({1}).", waveidCount, waveInfoCount);
                }

                var waveidOffsets = mReader.ReadS32s(waveidCount);

                var waveGroup = new WaveGroup();
                waveGroup.ArchiveFileName = archiveName;

                for (var j = 0; j < waveInfoCount; ++j)
                {
                    var wave = new Wave();

                    mReader.Goto(waveidOffsets[j]);

                    var waveid = (mReader.ReadS32() & 0xFFFF);
                    wave.WaveId = waveid;

                    mReader.Goto(waveInfoOffsets[j]);
                    mReader.Step(1);                     // unknown

                    var format = (WaveFormat)mReader.Read8();

                    if (!format.IsDefined())
                    {
                        mareep.WriteError("WSYS: group #{0}: wave #{1}: bad format '{2}'.", i, j, (byte)format);
                    }
                    else
                    {
                        wave.Format = format;
                    }

                    var key = mReader.Read8();

                    if (key < 0 || key > 127)
                    {
                        mareep.WriteError("WSYS: group #{0}: wave #{1}: bad root key '{2}'.", i, j, key);
                    }
                    else
                    {
                        wave.RootKey = key;
                    }

                    mReader.Step(1);                     // alignment

                    var sampleRate = mReader.ReadF32();

                    if (sampleRate < 0.0f)
                    {
                        mareep.WriteError("WSYS: group #{0}: wave #{1}: bad sample rate '{2:F1}'.", i, j, sampleRate);
                    }
                    else
                    {
                        wave.SampleRate = sampleRate;
                    }

                    var waveStart = mReader.ReadS32();

                    if (waveStart < 0)
                    {
                        mareep.WriteError("WSYS: group #{0}: wave #{1}: bad wave start '{2}'.", i, j, waveStart);
                    }
                    else
                    {
                        wave.WaveStart = waveStart;
                    }

                    var waveSize = mReader.ReadS32();

                    if (waveSize < 0)
                    {
                        mareep.WriteError("WSYS: group #{0}: wave #{1}: bad wave size '{1}'.", i, j, waveSize);
                    }
                    else
                    {
                        wave.WaveSize = waveSize;
                    }

                    wave.Loop = (mReader.Read32() != 0);

                    var loopStart = mReader.ReadS32();

                    if (loopStart < 0)
                    {
                        mareep.WriteError("WSYS: group #{0}: wave #{1}: bad loop start '{2}'.", i, j, loopStart);
                    }
                    else
                    {
                        wave.LoopStart = loopStart;
                    }

                    var loopEnd = mReader.ReadS32();

                    if (loopEnd < 0)
                    {
                        mareep.WriteError("WSYS: group #{0}: wave #{1}: bad loop end '{2}'.", i, j, loopEnd);
                    }
                    else
                    {
                        wave.LoopEnd = loopEnd;
                    }

                    var sampleCount = mReader.ReadS32();
                    wave.SampleCount = mareep.CalculateSampleCount(format, waveSize);

                    if (loopStart > loopEnd)
                    {
                        mareep.WriteWarning("WSYS: group #{0}: wave #{1}: loop start '{2}' is greater than loop end '{3}'.\n", i, j, loopStart, loopEnd);
                    }

                    if (loopStart > wave.SampleCount)
                    {
                        mareep.WriteWarning("WSYS: group #{0}: wave #{1}: loop start '{2}' is greater than sample count '{3}'.\n", i, j, loopStart, wave.SampleCount);
                    }

                    if (loopEnd > wave.SampleCount)
                    {
                        mareep.WriteWarning("WSYS: group #{0}: wave #{1}: loop end '{2}' is greater than sample count '{3}'.\n", i, j, loopEnd, wave.SampleCount);
                    }

                    wave.HistoryLast   = mReader.ReadS16();
                    wave.HistoryPenult = mReader.ReadS16();

                    // rest of the fields are unknown or runtime

                    waveGroup.Add(wave);
                }

                waveBank.Add(waveGroup);
            }

            mReader.PopAnchor();
            mReader.Back();

            return(waveBank);
        }
Ejemplo n.º 20
0
        public override void load(Stream stream)
        {
            aBinaryReader reader = new aBinaryReader(stream, Endianness.Big);

            mFormat       = (gxTextureFormat)reader.Read8(); // 0000
            mTransparency = reader.Read8();                  // 0001
            mWidth        = reader.Read16();                 // 0002
            mHeight       = reader.Read16();                 // 0004
            mWrapS        = (gxWrapMode)reader.Read8();      // 0006
            mWrapT        = (gxWrapMode)reader.Read8();      // 0007
            reader.Step(1);                                  // 0008 (0001)
            mTlutFormat = (gxTlutFormat)reader.Read8();      // 0009
            int  tlutentrycount = reader.Read16();           // 000A
            long tlutoffset     = reader.Read32();           // 000C

            mMipMap     = (reader.Read8() != 0);             // 0010
            mEdgeLOD    = (reader.Read8() != 0);             // 0011
            mBiasClamp  = (reader.Read8() != 0);             // 0012
            mMaxAniso   = (gxAnisotropy)reader.Read8();      // 0013
            mMinFilter  = (gxTextureFilter)reader.Read8();   // 0014
            mMagFilter  = (gxTextureFilter)reader.Read8();   // 0015
            mMinLod     = reader.ReadS8();                   // 0016
            mMaxLod     = reader.ReadS8();                   // 0017
            mImageCount = reader.Read8();                    // 0018 (0001)
            mLodBias    = reader.ReadS16();                  // 001A
            long texoffset = reader.Read32();                // 001C

            loadImageData(reader, texoffset);
            if (tlutentrycount > 0)
            {
                loadPaletteData(reader, tlutentrycount, tlutoffset);
            }
        }
Ejemplo n.º 21
0
 public WidthEntry(aBinaryReader reader)
 {
     kerning = reader.Read8();
     width   = reader.Read8();
 }
Ejemplo n.º 22
0
 sbyte ReadPcm8()
 {
     return((sbyte)(mReader.Read8() - 128));            // 8-bit LPCM stores samples as unsigned
 }
Ejemplo n.º 23
0
        static void WriteText(uint ofs)
        {
            byte command;

            sReader.Keep();
            sReader.Goto(sTextOffset + ofs);
            var maxofs = 0u;

            do
            {
                var pos = sReader.Position - sTextOffset;
                command = sReader.Read8();
                sWriter.Write("  {0:X8} {1}", pos, sCommandNames[command]);
                var nextofs = 0u;
                switch (command)
                {
                case 0x00: sWriter.Write(" {0}", sReader.ReadS32()); break;

                case 0x01: sWriter.Write(" {0}", sReader.ReadF32()); break;

                case 0x02: {
                    var data  = sReader.ReadS32();
                    var value = FetchDataValue(data);
                    sWriter.Write(" {0} # \"{1}\"", data, value);
                    break;
                }

                case 0x03: sWriter.Write(" ${0:X8}", sReader.Read32()); break;

                case 0x04: WriteVar(); break;

                case 0x06: WriteVar(); break;

                case 0x07: WriteVar(); break;

                case 0x0D: {
                    sReader.Read8();                             // TSpcInterp skips this byte
                    WriteVar();
                    break;
                }

                case 0x1C: {
                    var dest   = sReader.Read32();
                    var args   = sReader.ReadS32();
                    var symbol = FetchSymbol(i => i.Data == dest);
                    if (symbol != null)
                    {
                        sWriter.Write(" {0}, {1}", FetchSymbolName(symbol), args);
                    }
                    else
                    {
                        sWriter.Write(" ${0:X8}, {1}", dest, args);
                    }
                    break;
                }

                case 0x1D: sWriter.Write(" {0}, {1}", FetchSymbolName(FetchSymbol(sReader.ReadS32())), sReader.ReadS32()); break;

                case 0x1E: sWriter.Write(" {0}", sReader.ReadS32()); break;

                case 0x1F: sWriter.Write(" {0}", sReader.ReadS32()); break;

                case 0x22: nextofs = WriteJmp(ofs); break;

                case 0x23: nextofs = WriteJmp(ofs); break;
                }
                sWriter.WriteLine();
                if (nextofs > maxofs)
                {
                    maxofs = nextofs;
                }
            } while (!IsReturnCommand(command) || sReader.Position <= sTextOffset + maxofs);
            sWriter.WriteLine();
            sReader.Back();
        }
Ejemplo n.º 24
0
        protected override void loadBlo1(aBinaryReader reader)
        {
            base.loadBlo1(reader);

            var finder = bloResourceFinder.getFinder();

            int numparams = reader.Read8();

            mTextureCount = 1;
            mTextures[0]  = finder.find <bloTexture>(reader, "timg");
            mPalette      = finder.find <bloPalette>(reader, "tlut");
            mBinding      = (bloBinding)reader.Read8();

            numparams -= 3;

            if (numparams > 0)
            {
                int bits = reader.Read8();
                mMirror   = (bloMirror)(bits & 3);
                mRotate90 = ((bits & 4) != 0);
                --numparams;
            }
            else
            {
                mMirror   = 0;
                mRotate90 = false;
            }

            if (numparams > 0)
            {
                int bits = reader.Read8();
                mWrapS = (bloWrapMode)((bits >> 2) & 3);
                mWrapT = (bloWrapMode)((bits >> 0) & 3);
                --numparams;
            }
            else
            {
                mWrapS = bloWrapMode.None;
                mWrapT = bloWrapMode.None;
            }

            if (numparams > 0)
            {
                mFromColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mFromColor = new bloColor(bloColor.cZero);
            }

            if (numparams > 0)
            {
                mToColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mToColor = new bloColor(bloColor.cOne);
            }

            for (int i = 0; i < 4; ++i)
            {
                if (numparams > 0)
                {
                    mColors[i] = new bloColor(reader.Read32());
                    --numparams;
                }
                else
                {
                    mColors[i] = new bloColor(bloColor.cWhite);
                }
            }

            reader.Skip(4);

            setBlendKonstColor();
            setBlendKonstAlpha();
        }