Пример #1
0
 public AssetCOLL(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #2
0
 public AssetJAW(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform)
 {
 }
Пример #3
0
 public AssetPIPT(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #4
0
 public AssetCAM(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform)
 {
     _position = new Vector3(ReadFloat(0x8), ReadFloat(0xC), ReadFloat(0x10));
     CreateTransformMatrix();
     ArchiveEditorFunctions.renderableAssets.Add(this);
 }
Пример #5
0
 public AssetWithMotion(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform)
 {
     Motion = game == Game.Incredibles ? new Motion_Mechanism_TSSM(this) : new Motion_Mechanism(this);
 }
Пример #6
0
 public AssetRenderWareModel(Section_AHDR AHDR, Game game, Endianness endianness, SharpRenderer renderer) : base(AHDR, game, endianness)
 {
     Setup(renderer);
 }
Пример #7
0
 public AssetWithData(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
 {
     Data = AHDR.data;
 }
Пример #8
0
        public static Section_AHDR CreateRWTXFromBitmap(string fileName, bool appendRW3, bool flip, bool mipmaps, bool compress)
        {
            string textureName = Path.GetFileNameWithoutExtension(fileName);

            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(fileName);

            List <byte> bitmapData = new List <byte>(bitmap.Width * bitmap.Height * 4);

            if (flip)
            {
                bitmap.RotateFlip(System.Drawing.RotateFlipType.RotateNoneFlipY);
            }

            for (int j = 0; j < bitmap.Height; j++)
            {
                for (int i = 0; i < bitmap.Width; i++)
                {
                    bitmapData.Add(bitmap.GetPixel(i, j).B);
                    bitmapData.Add(bitmap.GetPixel(i, j).G);
                    bitmapData.Add(bitmap.GetPixel(i, j).R);
                    bitmapData.Add(bitmap.GetPixel(i, j).A);
                }
            }

            TextureDictionary_0016 td = new TextureDictionary_0016()
            {
                textureDictionaryStruct = new TextureDictionaryStruct_0001()
                {
                    textureCount = 1, unknown = 0
                },
                textureNativeList = new List <TextureNative_0015>()
                {
                    new TextureNative_0015()
                    {
                        textureNativeStruct = new TextureNativeStruct_0001()
                        {
                            textureName       = textureName,
                            alphaName         = "",
                            height            = (short)bitmap.Height,
                            width             = (short)bitmap.Width,
                            mipMapCount       = 1,
                            addressModeU      = TextureAddressMode.TEXTUREADDRESSWRAP,
                            addressModeV      = TextureAddressMode.TEXTUREADDRESSWRAP,
                            filterMode        = TextureFilterMode.FILTERLINEAR,
                            bitDepth          = 32,
                            platformType      = 8,
                            compression       = 0,
                            hasAlpha          = false,
                            rasterFormatFlags = TextureRasterFormat.RASTER_C8888,
                            type    = 4,
                            mipMaps = new MipMapEntry[] { new MipMapEntry(bitmapData.Count, bitmapData.ToArray()) },
                        },
                        textureNativeExtension = new Extension_0003()
                    }
                },
                textureDictionaryExtension = new Extension_0003()
            };

            bitmap.Dispose();

            // created PC txd, now will convert to gamecube.
            if (!Directory.Exists(tempPcTxdsDir))
            {
                Directory.CreateDirectory(tempPcTxdsDir);
            }
            if (!Directory.Exists(tempGcTxdsDir))
            {
                Directory.CreateDirectory(tempGcTxdsDir);
            }

            ExportSingleTextureToDictionary(pathToPcTXD, ReadFileMethods.ExportRenderWareFile(td, currentTextureVersion), textureName);

            PerformTXDConversionExternal(false, compress, mipmaps);

            string assetName = textureName + (appendRW3 ? ".RW3" : "");

            ReadFileMethods.treatStuffAsByteArray = true;

            Section_AHDR AHDR = new Section_AHDR(BKDRHash(assetName), AssetType.RWTX, AHDRFlagsFromAssetType(AssetType.RWTX),
                                                 new Section_ADBG(0, assetName, "", 0), ReadFileMethods.ExportRenderWareFile(ReadFileMethods.ReadRenderWareFile(pathToGcTXD), currentTextureVersion));

            ReadFileMethods.treatStuffAsByteArray = false;

            File.Delete(pathToGcTXD);
            File.Delete(pathToPcTXD);

            return(AHDR);
        }
Пример #9
0
 public AssetSPLN(Section_AHDR AHDR, Game game, Platform platform, SharpRenderer renderer) : base(AHDR, game, platform)
 {
     Setup(renderer);
     CreateTransformMatrix();
     ArchiveEditorFunctions.renderableAssets.Add(this);
 }
Пример #10
0
 public static void ExportSingleTextureToDictionary(string fileName, Section_AHDR RWTX)
 {
     ExportSingleTextureToDictionary(fileName, RWTX.data, RWTX.ADBG.assetName.Replace(".RW3", ""));
 }
Пример #11
0
        public void AddTextureDictionary(string fileName, bool RW3)
        {
            UnsavedChanges = true;
            int layerIndex = 0;

            List <Section_LHDR> LHDRs = new List <Section_LHDR>
            {
                new Section_LHDR()
                {
                    layerType   = 1,
                    assetIDlist = new List <uint>(),
                    LDBG        = new Section_LDBG(-1)
                }
            };

            LHDRs.AddRange(DICT.LTOC.LHDRList);
            DICT.LTOC.LHDRList = LHDRs;

            ReadFileMethods.treatStuffAsByteArray = true;

            foreach (RWSection rw in ReadFileMethods.ReadRenderWareFile(fileName))
            {
                if (rw is TextureDictionary_0016 td)
                {
                    // For each texture in the dictionary...
                    foreach (TextureNative_0015 tn in td.textureNativeList)
                    {
                        string textureName = tn.textureNativeStruct.textureName;
                        if (RW3 && !textureName.Contains(".RW3"))
                        {
                            textureName += ".RW3";
                        }

                        // Create a new dictionary that has only that texture.
                        byte[] data = ReadFileMethods.ExportRenderWareFile(new TextureDictionary_0016()
                        {
                            textureDictionaryStruct = new TextureDictionaryStruct_0001()
                            {
                                textureCount = 1, unknown = 0
                            },
                            textureDictionaryExtension = new Extension_0003(),
                            textureNativeList          = new List <TextureNative_0015>()
                            {
                                tn
                            }
                        }, tn.renderWareVersion);

                        // And add the new dictionary as an asset.
                        Section_ADBG ADBG = new Section_ADBG(0, textureName, "", 0);
                        Section_AHDR AHDR = new Section_AHDR(BKDRHash(textureName), AssetType.RWTX, AHDRFlags.SOURCE_VIRTUAL | AHDRFlags.READ_TRANSFORM, ADBG, data);

                        if (ContainsAsset(AHDR.assetID))
                        {
                            RemoveAsset(AHDR.assetID);
                        }

                        AddAsset(layerIndex, AHDR);
                    }
                }
            }

            ReadFileMethods.treatStuffAsByteArray = false;
        }
Пример #12
0
 public AssetSNDI_GCN_V1(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #13
0
 public AssetFLY(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #14
0
 public AssetPICK(Section_AHDR AHDR) : base(AHDR)
 {
     SetupDictionary();
 }
Пример #15
0
 public AssetGRUP(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #16
0
        public static List <Section_AHDR> GetAssets(Game game, Platform platform, out bool success, out bool overwrite)
        {
            ImportTextures a = new ImportTextures();

            if (a.ShowDialog() == DialogResult.OK)
            {
                ReadFileMethods.treatStuffAsByteArray = true;

                List <Section_AHDR> AHDRs = new List <Section_AHDR>();

                List <string> forBitmap = new List <string>();

                for (int i = 0; i < a.filePaths.Count; i++)
                {
                    if (Path.GetExtension(a.filePaths[i]).ToLower().Equals(".rwtex"))
                    {
                        byte[] data = ReadFileMethods.ExportRenderWareFile(new TextureDictionary_0016()
                        {
                            textureDictionaryStruct = new TextureDictionaryStruct_0001()
                            {
                                textureCount = 1, unknown = 0
                            },
                            textureNativeList = new List <TextureNative_0015>()
                            {
                                new TextureNative_0015().FromBytes(File.ReadAllBytes(a.filePaths[i]))
                            },
                            textureDictionaryExtension = new Extension_0003()
                        }, currentTextureVersion(game));

                        string assetName = Path.GetFileNameWithoutExtension(a.filePaths[i]) + (a.checkBoxRW3.Checked ? ".RW3" : "");

                        Section_ADBG ADBG = new Section_ADBG(0, assetName, "", 0);
                        Section_AHDR AHDR = new Section_AHDR(Functions.BKDRHash(assetName), AssetType.RWTX, ArchiveEditorFunctions.AHDRFlagsFromAssetType(AssetType.RWTX), ADBG, data);

                        AHDRs.Add(AHDR);
                    }
                    else
                    {
                        forBitmap.Add(a.filePaths[i]);
                    }
                }

                AHDRs.AddRange(CreateRWTXsFromBitmaps(game, platform, forBitmap, a.checkBoxRW3.Checked, a.checkBoxFlipTextures.Checked, a.checkBoxMipmaps.Checked, a.checkBoxCompress.Checked));

                ReadFileMethods.treatStuffAsByteArray = false;

                if (game == Game.Scooby)
                {
                    for (int i = 0; i < AHDRs.Count; i++)
                    {
                        byte[] data = AHDRs[i].data;
                        FixTextureForScooby(ref data);
                        AHDRs[i].data = data;
                    }
                }

                success   = true;
                overwrite = a.checkBoxOverwrite.Checked;
                return(AHDRs);
            }
            else
            {
                success   = false;
                overwrite = false;
                return(null);
            }
        }
Пример #17
0
 public AssetSNDI_GCN_V2(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform)
 {
 }
Пример #18
0
 public AssetHANG(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #19
0
 public AssetDYNA(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform)
 {
     SetDynaSpecific(false);
 }
Пример #20
0
 public AssetVILP(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #21
0
 public AssetCSNM(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #22
0
 public AssetSIMP(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #23
0
 public AssetMODL(Section_AHDR AHDR, Game game, Endianness endianness, SharpRenderer renderer) : base(AHDR, game, endianness, renderer)
 {
 }
Пример #24
0
 public static Section_AHDR GetAsset(Section_AHDR AHDR, out bool success, out bool setPosition)
 {
     return(GetAsset(new AssetHeader(AHDR), out success, out setPosition));
 }
Пример #25
0
 public AssetNPC(Section_AHDR AHDR) : base(AHDR)
 {
 }
Пример #26
0
 public AssetLODT(Section_AHDR AHDR) : base(AHDR)
 {
     UpdateDictionary();
 }
Пример #27
0
 public AssetUI(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform)
 {
     _textureAssetID = ReadUInt(0x5C + Offset);
 }
Пример #28
0
 public AssetPICK(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform)
 {
     SetupDictionary();
 }
 public AssetRenderWareModel(Section_AHDR AHDR, Game game, Platform platform, SharpRenderer renderer) : base(AHDR, game, platform)
 {
     Setup(renderer);
 }
Пример #30
0
 public AssetSound(Section_AHDR AHDR, Game game, Platform platform) : base(AHDR, game, platform.Endianness())
 {
     SetFileType(game, platform);
 }