示例#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);
 }