示例#1
0
        public void Init(string name, GameFileCache gfc, bool hidef = true)
        {
            Name = name;
            var      modelnamel  = name.ToLowerInvariant();
            MetaHash modelhash   = JenkHash.GenHash(modelnamel);
            MetaHash modelhashhi = JenkHash.GenHash(modelnamel + "_hi");
            var      ydrhash     = hidef ? modelhashhi : modelhash;

            NameHash  = modelhash;
            ModelHash = ydrhash;

            var useHash = ModelHash;

            Ydr = gfc.GetYdr(ModelHash);
            if (Ydr == null)
            {
                useHash = NameHash;
                Ydr     = gfc.GetYdr(NameHash);
            }

            while ((Ydr != null) && (!Ydr.Loaded))
            {
                Thread.Sleep(20);//kinda hacky
                Ydr = gfc.GetYdr(useHash);
            }

            if (Ydr != null)
            {
                Drawable = Ydr.Drawable?.ShallowCopy() as Drawable;
            }


            UpdateEntity();
        }
示例#2
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            Inited = false;

            GameFileCache = gameFileCache;


            HeightmapFiles.Clear();


            if (gameFileCache.EnableDlc)
            {
                LoadHeightmap("update\\update.rpf\\common\\data\\levels\\gta5\\heightmap.dat");
                LoadHeightmap("update\\update.rpf\\common\\data\\levels\\gta5\\heightmapheistisland.dat");
            }
            else
            {
                LoadHeightmap("common.rpf\\data\\levels\\gta5\\heightmap.dat");
            }


            BuildVertices();

            Inited = true;
        }
示例#3
0
        public void Load(GameFileCache gameFileCache, XmlNode node)
        {
            //load from game file cache

            filename          = Xml.GetStringAttribute(node, "filename");
            trainConfigName   = Xml.GetStringAttribute(node, "trainConfigName");
            isPingPongTrack   = Xml.GetBoolAttribute(node, "isPingPongTrack");
            stopsAtStations   = Xml.GetBoolAttribute(node, "stopsAtStations");
            MPstopsAtStations = Xml.GetBoolAttribute(node, "MPstopsAtStations");
            speed             = Xml.GetFloatAttribute(node, "speed");
            brakingDist       = Xml.GetFloatAttribute(node, "brakingDist");

            RpfFileEntry = gameFileCache.RpfMan.GetEntry(filename) as RpfFileEntry;
            NodesString  = gameFileCache.RpfMan.GetFileUTF8Text(filename);
            SetNameFromFilename();
            FilePath = Name;

            Load(NodesString);

            BuildVertices();

            BuildBVH();

            Loaded = true;
        }
示例#4
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            Inited = false;

            GameFileCache = gameFileCache;

            Zones.Clear();
            Emitters.Clear();
            AllItems.Clear();


            List <AudioPlacement> placements = new List <AudioPlacement>();

            foreach (var relfile in GameFileCache.AudioDatRelFiles)
            {
                if (relfile == null)
                {
                    continue;
                }

                placements.Clear();

                CreatePlacements(relfile, placements, true);

                PlacementsDict[relfile] = placements.ToArray();
            }

            AllItems.AddRange(Zones);
            AllItems.AddRange(Emitters);

            Inited = true;
        }
示例#5
0
        private void InitProp(CutPropModelObject prop, GameFileCache gfc)
        {
            Prop = new YmapEntityDef();
            Prop.SetArchetype(gfc.GetArchetype(prop.StreamingName));

            AnimHash = prop.StreamingName;
        }
示例#6
0
        public void Init(CutFile cutFile, GameFileCache gfc, WorldForm wf)
        {
            CutFile       = cutFile;
            GameFileCache = gfc;
            WorldForm     = wf;

            var csf = cutFile?.CutsceneFile2;

            if (csf == null)
            {
                return;
            }
            if (gfc == null)
            {
                return;
            }


            Duration      = csf.fTotalDuration;
            CameraCutList = csf.cameraCutList;
            Position      = csf.vOffset;
            Rotation      = Quaternion.RotationAxis(Vector3.UnitZ, csf.fRotation);
            Objects       = csf.ObjectsDict;
            LoadEvents    = RecastArray <CutEvent>(csf.pCutsceneLoadEventList);
            PlayEvents    = RecastArray <CutEvent>(csf.pCutsceneEventList);
            ConcatDatas   = csf.concatDataList;


            LoadYcds();
            CreateSceneObjects();
            RaiseEvents(0.0f);
        }
示例#7
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus, Weather weather)
        {
            Weather   = weather;
            Timecycle = weather.Timecycle;
            var rpfman = gameFileCache.RpfMan;

            string filename = "common.rpf\\data\\clouds.xml";

            //TODO: RpfMan should be able to get the right version? or maybe let gameFileCache do it!
            string kffilename = "common.rpf\\data\\cloudkeyframes.xml";

            if (gameFileCache.EnableDlc)
            {
                kffilename = "update\\update.rpf\\common\\data\\cloudkeyframes.xml";
            }

            XmlDocument cloudsxml   = rpfman.GetFileXml(filename);
            XmlDocument cloudskfxml = rpfman.GetFileXml(kffilename);

            HatManager = new CloudHatManager();
            HatManager.Init(cloudsxml.DocumentElement); //CloudHatManager

            SettingsMap = new CloudSettingsMap();
            SettingsMap.Init(cloudskfxml.DocumentElement); //CloudSettingsMap

            Inited = true;
        }
示例#8
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            GameFileCache = gameFileCache;

            var rpfman = gameFileCache.RpfMan;

            string      trainsfilename = "common.rpf\\data\\levels\\gta5\\trains.xml";
            XmlDocument trainsxml      = rpfman.GetFileXml(trainsfilename);
            XmlElement  trainsdata     = trainsxml.DocumentElement;
            //TODO: parse train_configs


            string      tracksfilename = "common.rpf\\data\\levels\\gta5\\traintracks.xml";
            XmlDocument tracksxml      = rpfman.GetFileXml(tracksfilename);
            XmlElement  tracksdata     = tracksxml.DocumentElement;
            XmlNodeList tracks         = tracksdata.SelectNodes("train_track");

            TrainTracks.Clear();
            for (int i = 0; i < tracks.Count; i++)
            {
                var        trackxml = tracks[i];
                TrainTrack tt       = new TrainTrack();
                tt.Load(gameFileCache, trackxml);
                TrainTracks.Add(tt);
            }


            Inited = true;
        }
示例#9
0
        public YmapEntityDef RenderEntity = new YmapEntityDef(); //placeholder entity object for rendering


        public void Init(string name, GameFileCache gfc)
        {
            var hash = JenkHash.GenHash(name.ToLowerInvariant());

            Init(hash, gfc);
            Name = name;
        }
示例#10
0
 public void LoadDefaultComponents(GameFileCache gfc)
 {
     for (int i = 0; i < 12; i++)
     {
         SetComponentDrawable(i, 0, 0, 0, gfc);
     }
 }
示例#11
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            Dict.Clear();

            var rpfman = gameFileCache.RpfMan;

            LoadXml(rpfman.GetFileXml("common.rpf\\data\\timecycle\\timecycle_mods_1.xml"));
            LoadXml(rpfman.GetFileXml("common.rpf\\data\\timecycle\\timecycle_mods_2.xml"));
            LoadXml(rpfman.GetFileXml("common.rpf\\data\\timecycle\\timecycle_mods_3.xml"));
            LoadXml(rpfman.GetFileXml("common.rpf\\data\\timecycle\\timecycle_mods_4.xml"));

            LoadXml(rpfman.GetFileXml("update\\update.rpf\\common\\data\\timecycle\\timecycle_mods_1.xml"));
            LoadXml(rpfman.GetFileXml("update\\update.rpf\\common\\data\\timecycle\\timecycle_mods_2.xml"));//doesn't exist, but try anyway
            LoadXml(rpfman.GetFileXml("update\\update.rpf\\common\\data\\timecycle\\timecycle_mods_3.xml"));
            LoadXml(rpfman.GetFileXml("update\\update.rpf\\common\\data\\timecycle\\timecycle_mods_4.xml"));

            if (gameFileCache.EnableDlc)
            {
                foreach (var dlcrpf in gameFileCache.DlcActiveRpfs)
                {
                    foreach (var file in dlcrpf.AllEntries)
                    {
                        if (file.NameLower.EndsWith(".xml") && file.NameLower.StartsWith("timecycle_mods_"))
                        {
                            LoadXml(rpfman.GetFileXml(file.Path));
                        }
                    }
                }
            }


            gameFileCache.TimeCycleModsDict = Dict;
        }
示例#12
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            Inited = false;

            GameFileCache = gameFileCache;

            var rpfman = gameFileCache.RpfMan;


            Zones.Clear();
            Emitters.Clear();
            AllItems.Clear();


            Dictionary <uint, RpfFileEntry> datrelentries = new Dictionary <uint, RpfFileEntry>();
            var audrpf = rpfman.FindRpfFile("x64\\audio\\audio_rel.rpf");

            if (audrpf != null)
            {
                AddRpfDatRels(audrpf, datrelentries);
            }

            if (gameFileCache.EnableDlc)
            {
                var updrpf = rpfman.FindRpfFile("update\\update.rpf");
                if (updrpf != null)
                {
                    AddRpfDatRels(updrpf, datrelentries);
                }
                foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load from current dlc rpfs
                {
                    AddRpfDatRels(dlcrpf, datrelentries);
                }
            }


            foreach (var dat151entry in datrelentries.Values)
            {
                var relfile = rpfman.GetFile <RelFile>(dat151entry);
                if (relfile != null)
                {
                    foreach (var reldata in relfile.RelDatas)
                    {
                        if (reldata is Dat151AmbientZone)
                        {
                            Zones.Add(new AudioPlacement(relfile, reldata as Dat151AmbientZone));
                        }
                        else if (reldata is Dat151AmbientEmitter)
                        {
                            Emitters.Add(new AudioPlacement(relfile, reldata as Dat151AmbientEmitter));
                        }
                    }
                }
            }

            AllItems.AddRange(Zones);
            AllItems.AddRange(Emitters);

            Inited = true;
        }
示例#13
0
        public void Init(string name, GameFileCache gfc, bool hidef = true)
        {
            Name = name;
            var      modelnamel  = name.ToLowerInvariant();
            MetaHash modelhash   = JenkHash.GenHash(modelnamel);
            MetaHash modelhashhi = JenkHash.GenHash(modelnamel + "_hi");
            var      yfthash     = hidef ? modelhashhi : modelhash;

            VehicleInitData vid = null;

            if (gfc.VehiclesInitDict.TryGetValue(modelhash, out vid))
            {
                bool vehiclechange = NameHash != modelhash;
                ConvRoofDict = null;
                ConvRoofClip = null;
                ModelHash    = yfthash;
                NameHash     = modelhash;
                InitData     = vid;
                Yft          = gfc.GetYft(ModelHash);
                while ((Yft != null) && (!Yft.Loaded))
                {
                    Thread.Sleep(20);//kinda hacky
                    Yft = gfc.GetYft(ModelHash);
                }

                DisplayMake = GlobalText.TryGetString(JenkHash.GenHash(vid.vehicleMakeName.ToLowerInvariant()));
                DisplayName = GlobalText.TryGetString(JenkHash.GenHash(vid.gameName.ToLowerInvariant()));

                if (!string.IsNullOrEmpty(vid.animConvRoofDictName) && (vid.animConvRoofDictName.ToLowerInvariant() != "null"))
                {
                    var ycdhash  = JenkHash.GenHash(vid.animConvRoofDictName.ToLowerInvariant());
                    var cliphash = JenkHash.GenHash(vid.animConvRoofName?.ToLowerInvariant());
                    ConvRoofDict = gfc.GetYcd(ycdhash);
                    while ((ConvRoofDict != null) && (!ConvRoofDict.Loaded))
                    {
                        Thread.Sleep(20);//kinda hacky
                        ConvRoofDict = gfc.GetYcd(ycdhash);
                    }
                    ClipMapEntry cme = null;
                    ConvRoofDict?.ClipMap?.TryGetValue(cliphash, out cme);
                    ConvRoofClip = cme;
                }
            }
            else
            {
                ModelHash    = 0;
                NameHash     = 0;
                InitData     = null;
                Yft          = null;
                DisplayMake  = "-";
                DisplayName  = "-";
                ConvRoofDict = null;
                ConvRoofClip = null;
            }


            UpdateEntity();
        }
示例#14
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            Inited = false;

            GameFileCache = gameFileCache;

            var rpfman = gameFileCache.RpfMan;


            Zones.Clear();
            Emitters.Clear();
            AllItems.Clear();


            Dictionary <uint, RpfFileEntry> datrelentries = new Dictionary <uint, RpfFileEntry>();
            var audrpf = rpfman.FindRpfFile("x64\\audio\\audio_rel.rpf");

            if (audrpf != null)
            {
                AddRpfDatRels(audrpf, datrelentries);
            }

            if (gameFileCache.EnableDlc)
            {
                var updrpf = rpfman.FindRpfFile("update\\update.rpf");
                if (updrpf != null)
                {
                    AddRpfDatRels(updrpf, datrelentries);
                }
                foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load from current dlc rpfs
                {
                    AddRpfDatRels(dlcrpf, datrelentries);
                }
            }

            List <AudioPlacement> placements = new List <AudioPlacement>();

            foreach (var dat151entry in datrelentries.Values)
            {
                var relfile = rpfman.GetFile <RelFile>(dat151entry);
                if (relfile != null)
                {
                    AllFiles.Add(relfile);

                    placements.Clear();

                    CreatePlacements(relfile, placements, true);

                    PlacementsDict[relfile] = placements.ToArray();
                }
            }

            AllItems.AddRange(Zones);
            AllItems.AddRange(Emitters);

            Inited = true;
        }
示例#15
0
        private void InitWeapon(CutWeaponModelObject weap, GameFileCache gfc)
        {
            var name = weap.StreamingName.ToString();

            Weapon = new Weapon();
            Weapon.Init(name, gfc);

            AnimHash = weap.StreamingName;
        }
示例#16
0
        private void InitVehicle(CutVehicleModelObject veh, GameFileCache gfc)
        {
            var name = veh.StreamingName.ToString();

            Vehicle = new Vehicle();
            Vehicle.Init(name, gfc);

            AnimHash = veh.StreamingName;
        }
示例#17
0
        public NoelEnvironment(string environmentRoot)
        {
            if (Instance != null)
            {
                throw new Exception("Environment must be initialized as a singleton");
            }
            Instance = this;

            RootDirectory = Path.GetFullPath(environmentRoot);
            bool firstRun = EstablishEnvironment();

            if (firstRun)
            {
                foreach (var dir in EnvironmentDir.Directories())
                {
                    Directory.CreateDirectory(dir);
                }
            }

            Logger = CreateFileLogger();
            using (Logger.Context("Initializing environment"))
            {
                try
                {
                    Config = new ConfigCache(firstRun);

                    var gameConfig = Config.Get <GameDirectoryConfig>();
                    Seasons = gameConfig.Seasons
                              .Where(x => Directory.Exists(Path.Combine(EnvironmentDir.SeasonsDirectory, x.Root)))
                              .Select(x => new Season(x.Number, x.Root))
                              .ToList();

                    foreach (var season in Seasons)
                    {
                        Directory.CreateDirectory(season.FullWorkingFolderPath);
                    }

                    TranslationFileCache = new TranslationFileCache(this);
                    GameFileCache        = new GameFileCache(this);
                    BackupCache          = new BackupCache();
                }
                catch (Exception e)
                {
                    Logger.LogException(e);
                    Logger.LogLine("Abort");
                    throw new Exception("Exception occurred during environment initialization", e);
                }

                Logger.LogLine("Done");
            }
        }
示例#18
0
        public void InitYmapEntityArchetypes(GameFileCache gfc)
        {
            if (Owner == null)
            {
                return;
            }
            var arch = Owner.Archetype;

            if (Entities != null)
            {
                for (int j = 0; j < Entities.Length; j++)
                {
                    var ient  = Entities[j];
                    var iarch = gfc.GetArchetype(ient._CEntityDef.archetypeName);
                    ient.SetArchetype(iarch);

                    if (iarch == null)
                    {
                    }   //can't find archetype - des stuff eg {des_prologue_door}
                }

                UpdateBBs(arch);
            }

            if (EntitySets != null)
            {
                for (int e = 0; e < EntitySets.Length; e++)
                {
                    var entitySet = EntitySets[e];
                    var entities  = entitySet.Entities;
                    if (entities == null)
                    {
                        continue;
                    }

                    for (int i = 0; i < entities.Count; i++)
                    {
                        var ient  = entities[i];
                        var iarch = gfc.GetArchetype(ient._CEntityDef.archetypeName);
                        ient.SetArchetype(iarch);

                        if (iarch == null)
                        {
                        }   //can't find archetype - des stuff eg {des_prologue_door}
                    }
                }
            }
        }
示例#19
0
        private void InitPed(CutPedModelObject ped, GameFileCache gfc)
        {
            Ped = new Ped();
            Ped.Init(ped.StreamingName, gfc);
            Ped.LoadDefaultComponents(gfc);

            if (ped.StreamingName == JenkHash.GenHash("player_zero"))
            {
                //for michael, switch his outfit so it's not glitching everywhere (until it's fixed?)
                Ped.SetComponentDrawable(3, 27, 0, 0, gfc);
                Ped.SetComponentDrawable(4, 19, 0, 0, gfc);
                Ped.SetComponentDrawable(6, null, null, gfc);
            }

            AnimHash = ped.StreamingName;
        }
示例#20
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            Inited = false;

            GameFileCache = gameFileCache;


            WatermapFiles.Clear();


            LoadWatermap("common.rpf\\data\\levels\\gta5\\waterheight.dat");



            BuildVertices();

            Inited = true;
        }
示例#21
0
文件: Water.cs 项目: q4a/CodeWalker
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            GameFileCache = gameFileCache;

            var rpfman = gameFileCache.RpfMan;

            string filename = "common.rpf\\data\\levels\\gta5\\water.xml";

            XmlDocument waterxml = rpfman.GetFileXml(filename);

            XmlElement waterdata = waterxml.DocumentElement;

            XmlNodeList waterquads = waterdata.SelectNodes("WaterQuads/Item");

            WaterQuads.Clear();
            for (int i = 0; i < waterquads.Count; i++)
            {
                var waterquad = new WaterQuad();
                waterquad.Init(waterquads[i], i);
                WaterQuads.Add(waterquad);
            }

            XmlNodeList calmingquads = waterdata.SelectNodes("CalmingQuads/Item");

            CalmingQuads.Clear();
            for (int i = 0; i < calmingquads.Count; i++)
            {
                var calmingquad = new WaterCalmingQuad();
                calmingquad.Init(calmingquads[i], i);
                CalmingQuads.Add(calmingquad);
            }

            XmlNodeList wavequads = waterdata.SelectNodes("WaveQuads/Item");

            WaveQuads.Clear();
            for (int i = 0; i < wavequads.Count; i++)
            {
                var wavequad = new WaterWaveQuad();
                wavequad.Init(wavequads[i], i);
                WaveQuads.Add(wavequad);
            }

            Inited = true;
        }
示例#22
0
        public void SetComponentDrawable(int index, int drawbl, int alt, int tex, GameFileCache gfc)
        {
            var vi = Ymt?.VariationInfo;

            if (vi != null)
            {
                var compData = vi.GetComponentData(index);
                if (compData?.DrawblData3 != null)
                {
                    var item = (drawbl < (compData.DrawblData3?.Length ?? 0)) ? compData.DrawblData3[drawbl] : null;
                    if (item != null)
                    {
                        var name = item?.GetDrawableName(alt);
                        var texn = item?.GetTextureName(tex);
                        SetComponentDrawable(index, name, texn, gfc);
                    }
                }
            }
        }
示例#23
0
        public ModelForm(ExploreForm ExpForm = null)
        {
            InitializeComponent();


            gameFileCache = ExpForm?.GetFileCache();

            Renderer  = new Renderer(this, gameFileCache);
            camera    = Renderer.camera;
            timecycle = Renderer.timecycle;
            weather   = Renderer.weather;
            clouds    = Renderer.clouds;

            initedOk = Renderer.Init();

            Renderer.controllightdir       = !Settings.Default.Skydome;
            Renderer.rendercollisionmeshes = false;
            Renderer.renderclouds          = false;
            Renderer.rendermoon            = false;
            Renderer.renderskeletons       = true;
            Renderer.SelectionFlagsTestAll = true;
        }
示例#24
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus)
        {
            var rpfman = gameFileCache.RpfMan;

            string filename = "common.rpf\\data\\levels\\gta5\\time.xml";

            XmlDocument timexml = rpfman.GetFileXml(filename);

            XmlElement  time     = timexml.DocumentElement;
            XmlNode     suninfo  = time.SelectSingleNode("suninfo");
            XmlNode     mooninfo = time.SelectSingleNode("mooninfo");
            XmlNodeList samples  = time.SelectNodes("sample");
            XmlNodeList regions  = time.SelectNodes("region");

            sun_roll           = Xml.GetFloatAttribute(suninfo, "sun_roll");
            sun_yaw            = Xml.GetFloatAttribute(suninfo, "sun_yaw");
            moon_roll          = Xml.GetFloatAttribute(mooninfo, "moon_roll");
            moon_wobble_freq   = Xml.GetFloatAttribute(mooninfo, "moon_wobble_freq");
            moon_wobble_amp    = Xml.GetFloatAttribute(mooninfo, "moon_wobble_amp");
            moon_wobble_offset = Xml.GetFloatAttribute(mooninfo, "moon_wobble_offset");

            Samples.Clear();
            for (int i = 0; i < samples.Count; i++)
            {
                TimecycleSample tcs = new TimecycleSample();
                tcs.Init(samples[i]);
                Samples.Add(tcs);
            }

            Regions.Clear();
            for (int i = 0; i < regions.Count; i++)
            {
                Regions.Add(Xml.GetStringAttribute(regions[i], "name"));
            }

            Inited = true;
        }
示例#25
0
        public JenkIndForm(GameFileCache gameFileCache = null)
        {
            InitializeComponent();

            if (GlobalText.FullIndexBuilt)
            {
                IndexBuildComplete();
            }
            else
            {
                MainPanel.Enabled = false;
                Cursor            = Cursors.WaitCursor;

                if ((gameFileCache == null) || (gameFileCache.IsInited == false))
                {
                    Task.Run(() =>
                    {
                        GTA5Keys.LoadFromPath(GTAFolder.CurrentGTAFolder, Settings.Default.Key);
                        GameFileCache gfc     = GameFileCacheFactory.Create();
                        gfc.DoFullStringIndex = true;
                        gfc.Init(UpdateStatus, UpdateStatus);
                        IndexBuildComplete();
                    });
                }
                else
                {
                    Task.Run(() =>
                    {
                        UpdateStatus("Loading strings...");
                        gameFileCache.DoFullStringIndex = true;
                        gameFileCache.InitStringDicts();
                        IndexBuildComplete();
                    });
                }
            }
        }
示例#26
0
        public void LoadDicts(DlcSetupFile setupfile, RpfManager rpfman, GameFileCache gfc)
        {
            ExtraMounts.Clear();
            RpfDataFiles.Clear();

            foreach (var datafile in dataFiles)
            {
                string dfn = GameFileCache.GetDlcPlatformPath(datafile.filename).ToLower();
                if (datafile.fileType == "EXTRA_FOLDER_MOUNT_DATA")
                {
                    string efmdxmlpath = datafile.filename.Replace(setupfile.deviceName + ":", DlcFile.Path).Replace('/', '\\');
                    efmdxmlpath = gfc.GetDlcPatchedPath(efmdxmlpath);
                    XmlDocument efmdxml = rpfman.GetFileXml(efmdxmlpath);

                    DlcExtraFolderMountFile efmf = new DlcExtraFolderMountFile();
                    efmf.Load(efmdxml);

                    ExtraMounts[dfn] = efmf;
                }
                if (datafile.fileType == "EXTRA_TITLE_UPDATE_DATA")
                {
                    string etudxmlpath = datafile.filename.Replace(setupfile.deviceName + ":", DlcFile.Path).Replace('/', '\\');
                    etudxmlpath = gfc.GetDlcPatchedPath(etudxmlpath);
                    XmlDocument etudxml = rpfman.GetFileXml(etudxmlpath);

                    DlcExtraTitleUpdateFile etuf = new DlcExtraTitleUpdateFile();
                    etuf.Load(etudxml);

                    ExtraTitleUpdates = etuf;
                }
                if (datafile.fileType == "RPF_FILE")
                {
                    RpfDataFiles[dfn] = datafile;
                }
            }
        }
示例#27
0
 public BinarySearchForm(GameFileCache cache = null)
 {
     FileCache = cache;
     RpfMan    = cache?.RpfMan;
     InitializeComponent();
 }
示例#28
0
        public void SetComponentDrawable(int index, string name, string tex, GameFileCache gfc)
        {
            if (string.IsNullOrEmpty(name))
            {
                DrawableNames[index] = null;
                Drawables[index]     = null;
                Textures[index]      = null;
                Expressions[index]   = null;
                return;
            }

            MetaHash namehash = JenkHash.GenHash(name.ToLowerInvariant());
            Drawable d        = null;

            if (Ydd?.Dict != null)
            {
                Ydd.Dict.TryGetValue(namehash, out d);
            }
            if ((d == null) && (DrawableFilesDict != null))
            {
                RpfFileEntry file = null;
                if (DrawableFilesDict.TryGetValue(namehash, out file))
                {
                    var ydd = gfc.GetFileUncached <YddFile>(file);
                    while ((ydd != null) && (!ydd.Loaded))
                    {
                        Thread.Sleep(1);//kinda hacky
                        gfc.TryLoadEnqueue(ydd);
                    }
                    if (ydd?.Drawables?.Length > 0)
                    {
                        d = ydd.Drawables[0];//should only be one in this dict
                    }
                }
            }

            MetaHash texhash = JenkHash.GenHash(tex.ToLowerInvariant());
            Texture  t       = null;

            if (Ytd?.TextureDict?.Dict != null)
            {
                Ytd.TextureDict.Dict.TryGetValue(texhash, out t);
            }
            if ((t == null) && (TextureFilesDict != null))
            {
                RpfFileEntry file = null;
                if (TextureFilesDict.TryGetValue(texhash, out file))
                {
                    var ytd = gfc.GetFileUncached <YtdFile>(file);
                    while ((ytd != null) && (!ytd.Loaded))
                    {
                        Thread.Sleep(1);//kinda hacky
                        gfc.TryLoadEnqueue(ytd);
                    }
                    if (ytd?.TextureDict?.Textures?.data_items.Length > 0)
                    {
                        t = ytd.TextureDict.Textures.data_items[0];//should only be one in this dict
                    }
                }
            }

            CharacterCloth cc = null;

            if (Yld?.Dict != null)
            {
                Yld.Dict.TryGetValue(namehash, out cc);
            }
            if ((cc == null) && (ClothFilesDict != null))
            {
                RpfFileEntry file = null;
                if (ClothFilesDict.TryGetValue(namehash, out file))
                {
                    var yld = gfc.GetFileUncached <YldFile>(file);
                    while ((yld != null) && (!yld.Loaded))
                    {
                        Thread.Sleep(1);//kinda hacky
                        gfc.TryLoadEnqueue(yld);
                    }
                    if (yld?.ClothDictionary?.Clothes?.data_items?.Length > 0)
                    {
                        cc = yld.ClothDictionary.Clothes.data_items[0];//should only be one in this dict
                    }
                }
            }
            ClothInstance c = null;

            if (cc != null)
            {
                c = new ClothInstance();
                c.Init(cc, Skeleton);
            }

            Expression e = null;

            if (Yed?.ExprMap != null)
            {
                Yed.ExprMap.TryGetValue(namehash, out e);
            }


            if (d != null)
            {
                Drawables[index] = d.ShallowCopy() as Drawable;
            }
            if (t != null)
            {
                Textures[index] = t;
            }
            if (c != null)
            {
                Clothes[index] = c;
            }
            if (e != null)
            {
                Expressions[index] = e;
            }

            DrawableNames[index] = name;
        }
示例#29
0
        public void Init(MetaHash pedhash, GameFileCache gfc)
        {
            Name     = string.Empty;
            NameHash = 0;
            InitData = null;
            Ydd      = null;
            Ytd      = null;
            Yld      = null;
            Ycd      = null;
            Yed      = null;
            Yft      = null;
            Ymt      = null;
            AnimClip = null;
            for (int i = 0; i < 12; i++)
            {
                Drawables[i]   = null;
                Textures[i]    = null;
                Expressions[i] = null;
            }


            CPedModelInfo__InitData initdata = null;

            if (!gfc.PedsInitDict.TryGetValue(pedhash, out initdata))
            {
                return;
            }

            var ycdhash = JenkHash.GenHash(initdata.ClipDictionaryName.ToLowerInvariant());
            var yedhash = JenkHash.GenHash(initdata.ExpressionDictionaryName.ToLowerInvariant());

            //bool pedchange = NameHash != pedhash;
            //Name = pedname;
            NameHash = pedhash;
            InitData = initdata;
            Ydd      = gfc.GetYdd(pedhash);
            Ytd      = gfc.GetYtd(pedhash);
            Ycd      = gfc.GetYcd(ycdhash);
            Yed      = gfc.GetYed(yedhash);
            Yft      = gfc.GetYft(pedhash);

            PedFile pedFile = null;

            gfc.PedVariationsDict?.TryGetValue(pedhash, out pedFile);
            Ymt = pedFile;

            Dictionary <MetaHash, RpfFileEntry> peddict = null;

            gfc.PedDrawableDicts.TryGetValue(NameHash, out peddict);
            DrawableFilesDict = peddict;
            DrawableFiles     = DrawableFilesDict?.Values.ToArray();
            gfc.PedTextureDicts.TryGetValue(NameHash, out peddict);
            TextureFilesDict = peddict;
            TextureFiles     = TextureFilesDict?.Values.ToArray();
            gfc.PedClothDicts.TryGetValue(NameHash, out peddict);
            ClothFilesDict = peddict;
            ClothFiles     = ClothFilesDict?.Values.ToArray();

            RpfFileEntry clothFile = null;

            if (ClothFilesDict?.TryGetValue(pedhash, out clothFile) ?? false)
            {
                Yld = gfc.GetFileUncached <YldFile>(clothFile);
                while ((Yld != null) && (!Yld.Loaded))
                {
                    Thread.Sleep(1);//kinda hacky
                    gfc.TryLoadEnqueue(Yld);
                }
            }



            while ((Ydd != null) && (!Ydd.Loaded))
            {
                Thread.Sleep(1);//kinda hacky
                Ydd = gfc.GetYdd(pedhash);
            }
            while ((Ytd != null) && (!Ytd.Loaded))
            {
                Thread.Sleep(1);//kinda hacky
                Ytd = gfc.GetYtd(pedhash);
            }
            while ((Ycd != null) && (!Ycd.Loaded))
            {
                Thread.Sleep(1);//kinda hacky
                Ycd = gfc.GetYcd(ycdhash);
            }
            while ((Yed != null) && (!Yed.Loaded))
            {
                Thread.Sleep(1);//kinda hacky
                Yed = gfc.GetYed(yedhash);
            }
            while ((Yft != null) && (!Yft.Loaded))
            {
                Thread.Sleep(1);//kinda hacky
                Yft = gfc.GetYft(pedhash);
            }


            Skeleton = Yft?.Fragment?.Drawable?.Skeleton?.Clone();

            MetaHash     cliphash = JenkHash.GenHash("idle");
            ClipMapEntry cme      = null;

            Ycd?.ClipMap?.TryGetValue(cliphash, out cme);
            AnimClip = cme;

            var        exprhash = JenkHash.GenHash(initdata.ExpressionName.ToLowerInvariant());
            Expression expr     = null;

            Yed?.ExprMap?.TryGetValue(exprhash, out expr);
            Expression = expr;


            UpdateEntity();
        }
示例#30
0
        public void Init(GameFileCache gameFileCache, XmlNode node)
        {
            Name                     = Xml.GetChildInnerText(node, "Name");
            NameHash                 = new MetaHash(JenkHash.GenHash(Name.ToLower()));
            Sun                      = Xml.GetChildFloatAttribute(node, "Sun", "value");
            Cloud                    = Xml.GetChildFloatAttribute(node, "Cloud", "value");
            WindMin                  = Xml.GetChildFloatAttribute(node, "WindMin", "value");
            WindMax                  = Xml.GetChildFloatAttribute(node, "WindMax", "value");
            Rain                     = Xml.GetChildFloatAttribute(node, "Rain", "value");
            Snow                     = Xml.GetChildFloatAttribute(node, "Snow", "value");
            SnowMist                 = Xml.GetChildFloatAttribute(node, "SnowMist", "value");
            Fog                      = Xml.GetChildFloatAttribute(node, "Fog", "value");
            RippleBumpiness          = Xml.GetChildFloatAttribute(node, "RippleBumpiness", "value");
            RippleMinBumpiness       = Xml.GetChildFloatAttribute(node, "RippleMinBumpiness", "value");
            RippleMaxBumpiness       = Xml.GetChildFloatAttribute(node, "RippleMaxBumpiness", "value");
            RippleBumpinessWindScale = Xml.GetChildFloatAttribute(node, "RippleBumpinessWindScale", "value");
            RippleScale              = Xml.GetChildFloatAttribute(node, "RippleScale", "value");
            RippleSpeed              = Xml.GetChildFloatAttribute(node, "RippleSpeed", "value");
            RippleVelocityTransfer   = Xml.GetChildFloatAttribute(node, "RippleVelocityTransfer", "value");
            OceanBumpiness           = Xml.GetChildFloatAttribute(node, "OceanBumpiness", "value");
            DeepOceanScale           = Xml.GetChildFloatAttribute(node, "DeepOceanScale", "value");
            OceanNoiseMinAmplitude   = Xml.GetChildFloatAttribute(node, "OceanNoiseMinAmplitude", "value");
            OceanWaveAmplitude       = Xml.GetChildFloatAttribute(node, "OceanWaveAmplitude", "value");
            ShoreWaveAmplitude       = Xml.GetChildFloatAttribute(node, "ShoreWaveAmplitude", "value");
            OceanWaveWindScale       = Xml.GetChildFloatAttribute(node, "OceanWaveWindScale", "value");
            ShoreWaveWindScale       = Xml.GetChildFloatAttribute(node, "ShoreWaveWindScale", "value");
            OceanWaveMinAmplitude    = Xml.GetChildFloatAttribute(node, "OceanWaveMinAmplitude", "value");
            ShoreWaveMinAmplitude    = Xml.GetChildFloatAttribute(node, "ShoreWaveMinAmplitude", "value");
            OceanWaveMaxAmplitude    = Xml.GetChildFloatAttribute(node, "OceanWaveMaxAmplitude", "value");
            ShoreWaveMaxAmplitude    = Xml.GetChildFloatAttribute(node, "ShoreWaveMaxAmplitude", "value");
            OceanFoamIntensity       = Xml.GetChildFloatAttribute(node, "OceanFoamIntensity", "value");
            OceanFoamScale           = Xml.GetChildFloatAttribute(node, "OceanFoamScale", "value");
            RippleDisturb            = Xml.GetChildFloatAttribute(node, "RippleDisturb", "value");
            Lightning                = Xml.GetChildFloatAttribute(node, "Lightning", "value");
            Sandstorm                = Xml.GetChildFloatAttribute(node, "Sandstorm", "value");
            OldSettingName           = Xml.GetChildInnerText(node, "OldSettingName");
            DropSettingName          = Xml.GetChildInnerText(node, "DropSettingName");
            MistSettingName          = Xml.GetChildInnerText(node, "MistSettingName");
            GroundSettingName        = Xml.GetChildInnerText(node, "GroundSettingName");
            TimeCycleFilename        = Xml.GetChildInnerText(node, "TimeCycleFilename");
            CloudSettingsName        = Xml.GetChildInnerText(node, "CloudSettingsName");


            if (!string.IsNullOrEmpty(TimeCycleFilename))
            {
                //TODO: RpfMan should be able to get the right version? or maybe let gameFileCache do it!
                string fname  = TimeCycleFilename.ToLower();
                bool   useupd = gameFileCache.EnableDlc;
                if (useupd)
                {
                    fname = fname.Replace("common:", "update/update.rpf/common");
                }
                XmlDocument tcxml = gameFileCache.RpfMan.GetFileXml(fname);
                if (useupd && !tcxml.HasChildNodes)
                {
                    fname = TimeCycleFilename.ToLower();
                    tcxml = gameFileCache.RpfMan.GetFileXml(fname);
                }

                foreach (XmlNode cycle in tcxml.DocumentElement.ChildNodes)
                {
                    TimeCycleData = new WeatherCycleKeyframeData();
                    TimeCycleData.Init(cycle);
                }
            }
        }