コード例 #1
0
ファイル: uiTagData.cs プロジェクト: mirkomihaljcic/Ascension
        public void LoadValue(HaloMap Map, int parentOffset)
        {
            base.Enabled = false;
            Map.IO.In.BaseStream.Position = parentOffset + ValueData.Offset;
            fullOffset     = (int)Map.IO.In.BaseStream.Position;
            HMap           = Map;
            ValueData.Size = Map.IO.In.ReadUInt32();
            Stream baseStream = Map.IO.In.BaseStream;

            baseStream.Position  += 8L;
            ValueData.Pointer     = Map.IO.In.ReadInt32() - Map.Map_Header.mapMagic;
            lblValueType.Text     = "data{" + ValueData.Size.ToString() + "}";
            txtArrayBox.MaxLength = (int)(ValueData.Size * 2);
            if (ValueData.Size > 0x400)
            {
                txtArrayBox.Text = "Data too long. Reading skipped.";
            }
            else if (((ValueData.Size > 0) && (ValueData.Pointer > 0)) && (ValueData.Pointer < Map.Map_Header.fileSize))
            {
                Map.IO.In.BaseStream.Position = ValueData.Pointer;
                txtArrayBox.Text = ExtraFunctions.BytesToHexString(Map.IO.In.ReadBytes((int)ValueData.Size));
                base.Enabled     = true;
            }
            Editted = false;
        }
コード例 #2
0
        private static Image Deswizzle(string FilePath)
        {
            EndianReader endianReader = new EndianReader((Stream) new FileStream(FilePath, FileMode.Open, FileAccess.Read), EndianType.LittleEndian);

            endianReader.BaseStream.Position = 12L;
            int height = endianReader.ReadInt32();
            int width  = endianReader.ReadInt32();

            endianReader.BaseStream.Position = 92L;
            string hexString = ExtraFunctions.BytesToHexString(endianReader.ReadBytes(12));

            endianReader.BaseStream.Position = 128L;
            int count = width * height * 4;

            byte[] buffer = endianReader.ReadBytes(count);
            endianReader.Close();
            if (hexString == "FF03000000FC0F000000F03F")
            {
                Image image = XboxScreenshot.DeswizzleA2R10G10B10(buffer, width, height);
                if (AppSettings.Settings.AdjustGamma)
                {
                    BitmapData bitmapData = ((Bitmap)image).LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
                    XboxScreenshot.GammaCorrect(AppSettings.Settings.GammaValue, bitmapData);
                    ((Bitmap)image).UnlockBits(bitmapData);
                }
                return(image);
            }
            if (hexString == "0000FF0000FF0000FF000000")
            {
                return(XboxScreenshot.DeswizzleA8R8G8B8(buffer, width, height));
            }
            return((Image)null);
        }
コード例 #3
0
 public void LoadValue(HaloMap Map, int parentOffset)
 {
     Map.IO.In.BaseStream.Position = parentOffset + ValueData.Offset;
     fullOffset = (int)Map.IO.In.BaseStream.Position;
     HMap       = Map;
     byte[] data = Map.IO.In.ReadBytes(ValueData.Length);
     txtArrayBox.Text = ExtraFunctions.BytesToHexString(data);
     Editted          = false;
 }
コード例 #4
0
        private static Image Deswizzle(string FilePath)
        {
            //Open the temp dds
            FileStream   fs = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
            EndianReader br = new EndianReader(fs, EndianType.LittleEndian);

            //Read the dds header
            br.BaseStream.Position = 0x0C;
            int height = br.ReadInt32();
            int width  = br.ReadInt32();

            //Read our random bytes
            br.BaseStream.Position = 0x5C;
            string randomBuf = ExtraFunctions.BytesToHexString(br.ReadBytes(12));

            //Read the buffer
            br.BaseStream.Position = 0x80;
            int size = width * height * 4;

            byte[] buffer = br.ReadBytes(size);
            br.Close();

            //A2R10G10B10
            if (randomBuf == "FF03000000FC0F000000F03F")
            {
                Image img = DeswizzleA2R10G10B10(buffer, width, height);
                //See if we have to fix the gamma
                if (AppSettings.Settings.AdjustGamma)
                {
                    BitmapData imageData = ((Bitmap)img).LockBits(
                        new Rectangle(0, 0, img.Width, img.Height),
                        ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
                    GammaCorrect(AppSettings.Settings.GammaValue, imageData);
                    ((Bitmap)img).UnlockBits(imageData);
                }
                return(img);
            }
            //A8R8G8B8?
            else if (randomBuf == "0000FF0000FF0000FF000000")
            {
                return(DeswizzleA8R8G8B8(buffer, width, height));
            }
            return(null);
        }
コード例 #5
0
 public RTHData.RTHDataBlock ReturnRTHDataBlock(int parentMemoryOffset)
 {
     //Initialize our RTH Data Block
     RTHData.RTHDataBlock RTH_Data_Block = new RTHData.RTHDataBlock();
     //Set our memory offset
     RTH_Data_Block.Memory_Offset = (uint)(parentMemoryOffset + IdentData.Offset) - 12;
     //Get our class data
     byte[] classData = ExtraFunctions.StringToBytes(cmbxClass.Text);
     //Get our blank data
     byte[] blankData = new byte[8];
     //Create our identData array
     byte[] identData = null;
     //If the value isn't null
     if (cmbxName.Text != "<<null>>")
     {
         //Assign our ident
         identData =
             ExtraFunctions.HexStringToBytes(
                 HMap.IndexItems[HMap.GetTagIndexByClassAndName(cmbxClass.Text, cmbxName.Text)].Ident.ToString("X"));
     }
     else
     {
         //Otherwise, if it is, we assign a null value
         identData = new byte[4] {
             0xFF, 0xFF, 0xFF, 0xFF
         };
     }
     RTH_Data_Block.Data_Block =
         ExtraFunctions.HexStringToBytes(ExtraFunctions.BytesToHexString(classData) +
                                         ExtraFunctions.BytesToHexString(blankData) +
                                         ExtraFunctions.BytesToHexString(identData));
     //Set our block size
     RTH_Data_Block.Block_Size = 16;
     //Return the RTH Data Block instance
     return(RTH_Data_Block);
 }
コード例 #6
0
 public static string GetUserKey()
 {
     return(ExtraFunctions.BytesToHexString(GetHash(GetOperatingSystemInfo())));
 }
コード例 #7
0
        public string getValue(uint offset, string type)
        {
            string format = "";

            if (checkBox1.Checked)
            {
                format = "X";
            }
            else
            {
                format = "";
            }
            object obj2 = null;

            if (AppSettings.Settings.IP_and_XDK_Name != "")
            {
                XboxDebugCommunicator communicator = new XboxDebugCommunicator(AppSettings.Settings.IP_and_XDK_Name);
                if (!communicator.Connected)
                {
                    try
                    {
                        communicator.Connect();
                    }
                    catch
                    {
                    }
                }
                XboxMemoryStream        stream = communicator.ReturnXboxMemoryStream();
                HaloReach3d.IO.EndianIO nio    = new HaloReach3d.IO.EndianIO(stream, HaloReach3d.IO.EndianType.BigEndian);
                nio.Open();
                nio.In.BaseStream.Position = offset;
                if ((type == "String") | (type == "string"))
                {
                    obj2 = nio.In.ReadString();
                }
                if (type == "Unicode String")
                {
                    obj2 = nio.In.ReadUnicodeString(int.Parse(textBox4.Text));
                }
                if (type == "ASCII String")
                {
                    obj2 = nio.In.ReadAsciiString(int.Parse(textBox4.Text));
                }
                if ((type == "Float") | (type == "float"))
                {
                    obj2 = nio.In.ReadSingle();
                }
                if ((type == "Double") | (type == "double"))
                {
                    obj2 = nio.In.ReadDouble();
                }
                if ((type == "Short") | (type == "short"))
                {
                    obj2 = nio.In.ReadInt16().ToString(format);
                }
                if ((type == "Byte") | (type == "byte"))
                {
                    obj2 = nio.In.ReadByte().ToString(format);
                }
                if ((type == "Long") | (type == "long"))
                {
                    obj2 = nio.In.ReadInt32().ToString(format);
                }
                if ((type == "Quad") | (type == "quad"))
                {
                    obj2 = nio.In.ReadInt64().ToString(format);
                }
                if ((type == "Bytes") | (type == "bytes"))
                {
                    if (textBox4.Text == "")
                    {
                        textBox4.Text = "4";
                    }
                    obj2 = ExtraFunctions.BytesToHexString(nio.In.ReadBytes(int.Parse(textBox4.Text)));
                }
                nio.Close();
                stream.Close();
                communicator.Disconnect();
                return(obj2.ToString());
            }
            MessageBox.Show("XDK Name/IP not set");
            return("No Console Detected");
        }