FindItem() public méthode

public FindItem ( QbItemType type, bool recursive ) : QbItemBase
type QbItemType
recursive bool
Résultat QbItemBase
Exemple #1
0
        public void ResetBonusArt(QbFile storeDataQb)
        {
            if (_project.GameInfo.Game == Game.GH3_Wii || _project.GameInfo.Game == Game.GHA_Wii)
            {
                QbItemArray qa = storeDataQb.FindItem(QbKey.Create("Bonus_Songs_Info"), false) as QbItemArray;

                if (qa != null)
                {
                    //set all prices to 0
                    QbKey cover = QbKey.Create("album_cover");
                    qa.FindItem(true, delegate(QbItemBase qib)
                    {
                        if (qib.ItemQbKey != null && qib.ItemQbKey.Crc == cover.Crc)
                            ((QbItemQbKey)qib).Values[0] = QbKey.Create("store_song_default");
                        return false; //loop until end of qb
                    });

                    storeDataQb.AlignPointers();
                    storeDataQb.IsValid();
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Remove song to bonus list and shop
        /// </summary>
        /// <param name="songQk"></param>
        public void RemoveBonusSongQbItems(QbKey songQk, QbFile qbStore)
        {
            QbItemBase item;

            //find bonus song list
            QbItemArray bonusSongs = qbStore.FindItem(QbKey.Create("songs"), true) as QbItemArray;

            //find bonus song price list
            QbItemStruct songData = qbStore.FindItem(QbKey.Create("store_song_data"), true) as QbItemStruct;

            //find bonus song info
            QbItemArray bonusInfo = qbStore.FindItem(QbKey.Create("Bonus_Songs_Info"), true) as QbItemArray;

            //remove bonus song from list
            if (bonusSongs != null)
            {
                List<QbKey> songs = new List<QbKey>((bonusSongs.Items[0] as QbItemQbKey).Values);
                songs.Remove(songQk);
                (bonusSongs.Items[0] as QbItemQbKey).Values = songs.ToArray();
            }

            //remove bonus song price
            if (songData != null)
            {
                item = songData.FindItem(false, delegate(QbItemBase qib)
                    {
                        return (qib.ItemQbKey.Crc == songQk.Crc);
                    });
                if (item != null)
                    songData.RemoveItem(item);
            }

            //remove bonus info
            if (bonusInfo != null && bonusInfo.Items.Count > 0)
            {
                QbKey itemQk = QbKey.Create("item");
                QbItemStructArray infoArray = (bonusInfo.Items[0] as QbItemStructArray);
                item = infoArray.FindItem(false, delegate(QbItemBase qib)
                    {
                        QbItemQbKey iqk = (QbItemQbKey)(qib.Items[0]);
                        return iqk.ItemQbKey.Crc == itemQk.Crc && iqk.Values[0] == songQk.Crc;
                    });
                if (item != null)
                    infoArray.RemoveItem(item);
            }

            qbStore.AlignPointers();
            qbStore.IsValid();
        }
Exemple #3
0
 public void RemoveIntroVids(QbFile bootupMenuFlowQb)
 {
     if (_project.GameInfo.Game == Game.GH3_Wii || _project.GameInfo.Game == Game.GHA_Wii)
     {
         //remove the intro videos
         QbItemScript qbs = bootupMenuFlowQb.FindItem(QbKey.Create("bootup_sequence"), false) as QbItemScript;
         if (qbs.ScriptData.Length == 474) //make sure it hasn't already been edited
         {
             byte[] scr = new byte[68 + 130];
             Array.Copy(qbs.ScriptData, scr, 68);
             Array.Copy(qbs.ScriptData, qbs.ScriptData.Length - 130, scr, 68, 130);
             qbs.ScriptData = scr;
             bootupMenuFlowQb.AlignPointers();
             bootupMenuFlowQb.IsValid();
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// Add song to bonus list and shop
        /// </summary>
        /// <param name="songQk"></param>
        public void AddBonusSongQbItems(QbKey songQk, QbFile qbStore, bool insertAdd)
        {
            QbKey qkCreditsSong = _project.GameInfo.Game == Game.GH3_Wii ? QbKey.Create("thrufireandflames") : QbKey.Create("kingsandqueenscredits");

            //find bonus song list
            QbItemArray bonusSongs = qbStore.FindItem(QbKey.Create("songs"), true) as QbItemArray;

            //find bonus song price list
            QbItemStruct songData = qbStore.FindItem(QbKey.Create("store_song_data"), true) as QbItemStruct;

            //find bonus song info
            QbItemArray bonusInfo = qbStore.FindItem(QbKey.Create("Bonus_Songs_Info"), true) as QbItemArray;

            //add bonus song to list
            if (bonusSongs != null)
            {
                List<QbKey> songs = new List<QbKey>((bonusSongs.Items[0] as QbItemQbKey).Values);
                if (!songs.Contains(songQk))
                {
                    if (insertAdd)
                        songs.Insert(0, songQk.Clone());
                    else
                    {
                        //insert second from the end (before TTFAF / kingandqueenscredits)
                        if (songs.Count == 0 || songs[songs.Count - 1].Crc != qkCreditsSong.Crc)
                            songs.Add(songQk.Clone()); //clone qbkey
                        else
                            songs.Insert(songs.Count - 1, songQk.Clone()); //clone qbkey
                    }
                    (bonusSongs.Items[0] as QbItemQbKey).Values = songs.ToArray();
                }
            }

            if (songData != null)
            {
                //add bonus song price
                if (null == songData.FindItem(false, delegate(QbItemBase qib)
                    {
                        return (qib.ItemQbKey.Crc == songQk.Crc);
                    }))
                {
                    QbItemStruct songDataItem = new QbItemStruct(qbStore);
                    songDataItem.Create(QbItemType.StructItemStruct);
                    songDataItem.ItemQbKey = songQk.Clone();
                    QbItemInteger songDataItemPrice = new QbItemInteger(qbStore);
                    songDataItemPrice.Create(QbItemType.StructItemInteger);
                    songDataItemPrice.ItemQbKey = QbKey.Create("price");
                    songDataItemPrice.Values = new uint[] { 0 };
                    songDataItem.AddItem(songDataItemPrice);
                    if (!insertAdd || songData.Items.Count == 0)
                        songData.AddItem(songDataItem);
                    else
                        songData.InsertItem(songDataItem, songData.Items[0], true);
                }
            }

            if (bonusInfo != null)
            {
                //add bonus info
                QbKey itemQk = QbKey.Create("item");
                QbItemStructArray infoArray = (bonusInfo.Items[0] as QbItemStructArray);
                if (null == infoArray.FindItem(false, delegate(QbItemBase qib)
                    {
                        QbItemQbKey iqk = (QbItemQbKey)(qib.Items[0]);
                        return iqk.ItemQbKey.Crc == itemQk.Crc && iqk.Values[0] == songQk.Crc;
                    }))
                {
                    QbItemStruct infoStruct = new QbItemStruct(qbStore);
                    infoStruct.Create(QbItemType.StructHeader);
                    if (!insertAdd || infoArray.Items.Count == 0)
                        infoArray.AddItem(infoStruct);
                    else
                        infoArray.InsertItem(infoStruct, infoArray.Items[0], true);
                    qbStore.AlignPointers();
                    qbStore.IsValid();
                    QbItemQbKey infoItem = new QbItemQbKey(qbStore);
                    infoItem.Create(QbItemType.StructItemQbKey);
                    infoItem.ItemQbKey = itemQk; //"item"
                    infoItem.Values = new QbKey[] { songQk.Clone() };
                    infoStruct.AddItem(infoItem);
                    qbStore.AlignPointers();
                    qbStore.IsValid();
                    QbItemString infoText = new QbItemString(qbStore);
                    infoText.Create(QbItemType.StructItemString);
                    infoText.ItemQbKey = QbKey.Create("text");
                    infoText.Strings = new string[] { "Bonus song added with TheGHOST" };
                    infoStruct.AddItem(infoText);
                    qbStore.AlignPointers();
                    qbStore.IsValid();
                    QbItemQbKey infoCover = new QbItemQbKey(qbStore);
                    infoCover.Create(QbItemType.StructItemQbKey);
                    infoCover.ItemQbKey = QbKey.Create("album_cover");
                    infoCover.Values = new QbKey[] { QbKey.Create("store_song_default") };
                    infoStruct.AddItem(infoCover);
                    qbStore.AlignPointers();
                    qbStore.IsValid();
                }
            }
        }
Exemple #5
0
        public void FreeStore(QbFile storeDataQb)
        {
            if (_project.GameInfo.Game == Game.GH3_Wii || _project.GameInfo.Game == Game.GHA_Wii)
            {
                //set all prices to 0
                QbKey price = QbKey.Create("price");
                storeDataQb.FindItem(true, delegate(QbItemBase qib)
                    {
                        if (qib.ItemQbKey != null && qib.ItemQbKey.Crc == price.Crc)
                            ((QbItemInteger)qib).Values[0] = 0;
                        return false; //loop until end of qb
                    });

                storeDataQb.AlignPointers();
                storeDataQb.IsValid();
            }
        }
Exemple #6
0
        private void removeSongFromSonglist(QbFile qbSongList, QbKey qkSong)
        {
            QbItemArray songsList = qbSongList.FindItem(QbKey.Create("gh3_songlist"), false) as QbItemArray;
            if (songsList != null)
            {
                List<QbKey> songlistQk = new List<QbKey>(((QbItemQbKey)songsList.Items[0]).Values);

                if (songlistQk.Contains(qkSong))
                    songlistQk.Remove(qkSong);

                //update gh3_songlist
                ((QbItemQbKey)songsList.Items[0]).Values = songlistQk.ToArray();

                qbSongList.AlignPointers();
                qbSongList.IsValid();
            }
        }
Exemple #7
0
        private void unlockXSongsToProgress(QbFile guitarProgressionQb, int easy, int medium, int hard, int expert, int bonus)
        {
            Dictionary<uint, int> vals = new Dictionary<uint, int>(4);
            vals.Add(QbKey.Create("easy").Crc, easy);
            vals.Add(QbKey.Create("medium").Crc, medium);
            vals.Add(QbKey.Create("hard").Crc, hard);
            vals.Add(QbKey.Create("expert").Crc, expert);

            if (bonus != 0)
                vals.Add(QbKey.Create("bonus").Crc, bonus);

            //set the tiers to be complete after 1 song complete
            QbKey qk = QbKey.Create("GH3_Career_NumSongToProgress");
            QbItemStruct nsp = guitarProgressionQb.FindItem(false, delegate(QbItemBase qib)
            {
                return (qib.QbItemType == QbItemType.SectionStruct && qib.ItemQbKey.Crc == qk.Crc);
            }) as QbItemStruct;
            if (nsp != null)
            {
                foreach (QbItemBase qib in nsp.Items)
                {
                    if (qib.QbItemType == QbItemType.StructItemInteger && qib.ItemQbKey != null && vals.ContainsKey(qib.ItemQbKey.Crc))
                        ((QbItemInteger)qib).Values[0] = (uint)vals[qib.ItemQbKey.Crc]; //set to 1 item
                }
            }
        }
Exemple #8
0
        private List<QbKey> getAllCareerSongs(QbFile guitarProgression)
        {
            QbItemStruct careerSongsSec = guitarProgression.FindItem(QbKey.Create("GH3_Career_Songs"), false) as QbItemStruct;

            List<QbKey> songs = new List<QbKey>();

            if (careerSongsSec != null)
            {
                QbKey qkSongs = QbKey.Create("songs");
                careerSongsSec.FindItem(true, delegate(QbItemBase qib)
                    {
                        if (qib.ItemQbKey != null && qib.ItemQbKey.Crc == qkSongs.Crc)
                            songs.AddRange(((QbItemQbKey)qib.Items[0]).Values);
                        return false;
                    });
            }
            return songs;
        }
Exemple #9
0
        private bool removeBonusSong(QbFile storeQb, QbKey songId)
        {
            //find bonus song list
            QbItemArray bonusSongs = storeQb.FindItem(true, delegate(QbItemBase qib)
            {
                return (qib.QbItemType == QbItemType.StructItemArray && qib.ItemQbKey == QbKey.Create("songs"));
            }) as QbItemArray;

            //remove bonus song from list
            List<QbKey> songs = new List<QbKey>((bonusSongs.Items[0] as QbItemQbKey).Values);

            if (songs.Exists(delegate(QbKey qk)
                {
                    return qk.Crc == songId.Crc;
                }))
            {
                this.RemoveBonusSongQbItems(songId, storeQb);
                return true;
            }
            else
                return false;
        }
Exemple #10
0
        public void AddBonusSongsFromNonCareer(QbFile storeDataQb, QbFile songListQb, QbFile guitarProgressionQb)
        {
            List<QbKey> nc = _nonCareerSongs;

            if (nc.Count == 0)
                nc = _specialSongs;

            List<QbKey> c = getAllCareerSongs(guitarProgressionQb);

            foreach (QbKey qk in nc)
            {
                if (c.Contains(qk))
                    continue;

                //add the existing song to the shop
                this.BonusSongAddToGame(storeDataQb, songListQb, qk.Clone(), false);

                //force item to leaderboard
                QbItemStruct qis = songListQb.FindItem(qk, true) as QbItemStruct;
                if (qis != null)
                {
                    QbItemInteger qii = qis.FindItem(QbKey.Create("leaderboard"), false) as QbItemInteger;
                    if (qii != null)
                        qii.Values[0] = 1; //mark as leaderboard
                }

            }
        }
Exemple #11
0
        private List<QbKey> getAllBonusSongs(QbFile storeData)
        {
            QbItemStruct bonusSongsSec = storeData.FindItem(QbKey.Create("GH3_Bonus_Songs"), false) as QbItemStruct;

            List<QbKey> songs = new List<QbKey>();

            if (bonusSongsSec != null)
            {
                QbKey qkSongs = QbKey.Create("songs");
                bonusSongsSec.FindItem(true, delegate(QbItemBase qib)
                    {
                        if (qib.ItemQbKey != null && qib.ItemQbKey.Crc == qkSongs.Crc)
                            songs.AddRange(((QbItemQbKey)qib.Items[0]).Values);
                        return false;
                    });
            }
            return songs;
        }
Exemple #12
0
        //#if DEBUG
        //        /// <summary>
        //        /// Edits tiers using the files in Partition folder
        //        /// </summary>
        //        /// <param name="removeBossBattles"></param>
        //        /// <param name="bonusSongs"></param>
        //        /// <param name="songCounts"></param>
        //        public void CoopCopyTest(PakEditor pak)
        //        {
        //            QbKey[] nonCareerSongs = new QbKey[0];
        //            string progQb = @"scripts\guitar\guitar_progression.qb.ngc";
        //            string coopQb = @"scripts\guitar\guitar_coop.qb.ngc";
        //            string storeDataQb = @"scripts\guitar\store_data.qb.ngc";
        //            string songlistQb = @"scripts\guitar\songlist.qb.ngc";
        //            if (_project.GameInfo.Game == Game.GH3_Wii)
        //            {
        //                progQb = progQb.Substring(1);  //remove first char
        //                coopQb = coopQb.Substring(1);  //remove first char
        //                storeDataQb = storeDataQb.Substring(1);  //remove first char
        //                songlistQb = songlistQb.Substring(1);  //remove first char
        //            }
        //            if (_project.GameInfo.Game == Game.GH3_Wii || _project.GameInfo.Game == Game.GHA_Wii)
        //            {
        //                //add song to song list
        //                QbFile qbProg = pak.ReadQbFile(progQb);
        //                QbFile qbCoop = _project.GameInfo.Game == Game.GH3_Wii ? pak.ReadQbFile(coopQb) : null;
        //                QbFile qbStore = pak.ReadQbFile(storeDataQb);
        //                QbFile qbSonglist = pak.ReadQbFile(songlistQb);
        //                copyCareerTiersToCoop(qbCoop, qbProg);
        //                pak.ReplaceFile(coopQb, qbCoop);
        //            }
        //        }
        //#endif
        private void copyCareerTiersToCoop(QbFile coopQb, QbFile guitarProgressionQb)
        {
            int coopMoviesCount = 6;

            QbKey qkEncore = QbKey.Create("encorep1");
            QbKey qkEncore2 = QbKey.Create("encorep2");
            QbKey qkLevel = QbKey.Create("level");
            QbKey qkLevel2 = QbKey.Create("level2");
            QbKey qkNumTiers = QbKey.Create("num_tiers");
            QbKey qkCompMovie = QbKey.Create("completion_movie");
            QbKey qkSetList = QbKey.Create("setlist_icon");
            QbKey qkNumSongs = QbKey.Create("numsongstoprogress");
            QbKey qkCoopNumSongs = QbKey.Create("GH3_COOPCareer_NumSongToProgress");
            QbKey qkAtom = QbKey.Create("atom");
            QbKey qkTier = QbKey.Create("tier");

            QbItemStruct careerSongsSec = guitarProgressionQb.FindItem(QbKey.Create("GH3_Career_Songs"), false) as QbItemStruct;
            QbItemInteger qbNumTiers = careerSongsSec.FindItem(qkNumTiers, false) as QbItemInteger;
            int currTierCount = (int)qbNumTiers.Values[0];

            QbItemStruct coopSongsSec = coopQb.FindItem(QbKey.Create("GH3_CoopCareer_Songs"), false) as QbItemStruct;
            QbItemInteger qbCoopNumTiers = coopSongsSec.FindItem(qkNumTiers, false) as QbItemInteger;
            int currCoopTierCount = (int)qbCoopNumTiers.Values[0];
            qbCoopNumTiers.Values[0] = (uint)currTierCount; //set new value

            //copy file ids

            #region copy setlist

            for (int i = 1; i <= currCoopTierCount; i++)
            {
                QbItemStruct srcTier = coopSongsSec.FindItem(QbKey.Create(string.Format("tier{0}", i.ToString())), false) as QbItemStruct;
                if (srcTier == null)
                    continue;

                coopSongsSec.RemoveItem(srcTier);
            }

            for (int i = 1; i <= currTierCount; i++)
            {
                QbItemStruct srcTier = careerSongsSec.FindItem(QbKey.Create(string.Format("tier{0}", i.ToString())), false) as QbItemStruct;
                if (srcTier == null)
                    continue;

                srcTier = (QbItemStruct)srcTier.Clone();

                foreach (QbItemBase qib in srcTier.Items)
                {
                    if (qib.QbItemType == QbItemType.StructItemQbKey)
                    {
                        if (((QbItemQbKey)qib).Values[0].Crc == qkEncore.Crc)
                            ((QbItemQbKey)qib).Values[0] = qkEncore2.Clone();
                    }
                    else if (qib.QbItemType == QbItemType.StructItemString && qib.ItemQbKey != null && qib.ItemQbKey.Crc == qkCompMovie.Crc)
                    {
                        int m = i + 1;
                        if (m < currTierCount)
                            ((QbItemString)qib).Strings[0] = string.Format("coop_{0}", (m < coopMoviesCount ? m : (m % coopMoviesCount == 0 ? coopMoviesCount : m % coopMoviesCount)).ToString().PadLeft(2,'0'));
                        else
                            ((QbItemString)qib).Strings[0] = "singleplayer_end"; //on 2nd last tier

                    }
                }

                if (i == currTierCount) //last tier
                {
                    QbItemBase tmp = srcTier.FindItem(qkCompMovie, false);
                    if (tmp != null)
                        srcTier.RemoveItem(tmp); //no movie in last coop tier

                    tmp = srcTier.FindItem(qkSetList, false);
                    if (tmp != null)
                        srcTier.RemoveItem(tmp);

                    tmp = new QbItemQbKey(guitarProgressionQb);
                    tmp.Create(QbItemType.StructItemQbKey);
                    tmp.ItemQbKey = qkLevel2.Clone();
                    ((QbItemQbKey)tmp).Values = new QbKey[] { QbKey.Create("load_z_hell") };
                    srcTier.AddItem(tmp);

                    tmp = new QbItemQbKey(guitarProgressionQb);
                    tmp.Create(QbItemType.StructItemQbKey);
                    //tmp.ItemQbKey = null
                    ((QbItemQbKey)tmp).Values = new QbKey[] { QbKey.Create("nocash") };
                    srcTier.AddItem(tmp);

                }

                coopSongsSec.AddItem(srcTier);

                coopQb.AlignPointers();
                coopQb.IsValid();
            }

            #endregion

            #region copy songs to progress values

            QbItemStruct careerSongs = guitarProgressionQb.FindItem(QbKey.Create("GH3_Career_NumSongToProgress"), false) as QbItemStruct;
            QbItemStruct coopSongs = coopQb.FindItem(QbKey.Create("GH3_COOPCareer_NumSongToProgress"), false) as QbItemStruct;

            foreach (QbItemBase qib in careerSongs.Items)
            {
                QbItemInteger qbVal = coopSongs.FindItem(qib.ItemQbKey, false) as QbItemInteger;
                if (qbVal != null)
                    qbVal.Values[0] = ((QbItemInteger)qib).Values[0];
            }

            #endregion

            #region copy progression

            QbItemArray careerSongsProg = guitarProgressionQb.FindItem(QbKey.Create("GH3_Career_Progression"), false) as QbItemArray;
            QbItemArray coopSongsProg = coopQb.FindItem(QbKey.Create("GH3_CoopCareer_Progression"), false) as QbItemArray;

            string[] masks = new string[4];

            masks[0] = "career_tier{0}_songscomplete";
            masks[1] = "career_tier{0}_encoreunlock";
            masks[2] = "career_tier{0}_encorecomplete";
            masks[3] = "career_tier{0}_complete";

            //remove existing progression entries
            for (int i = 1; i <= currCoopTierCount; i++)
            {
                for (int c = 0; c < masks.Length; c++)
                {
                    QbItemBase qib = findTierProgStruct(QbKey.Create(string.Format(masks[c], i.ToString())), coopSongsProg);
                    if (qib != null)
                        coopSongsProg.Items[0].RemoveItem(qib);
                }
            }

            //point all checks for the setlist being complete to the last tier, do while less items in list
            QbKey qkEndOrig = QbKey.Create(string.Format(masks[3], currCoopTierCount - 1)); //-1 if original coop tier list
            QbKey qkEndTG = QbKey.Create(string.Format(masks[3], currCoopTierCount)); //TheGHOST has alreay edited this ISO
            QbKey qkEndNew = QbKey.Create(string.Format(masks[3], currTierCount)); //New value
            coopSongsProg.Items[0].FindItem(true, delegate(QbItemBase qb)
                {
                    if (qb.ItemQbKey != null && qb.ItemQbKey.Crc == qkAtom.Crc)
                    {
                        QbItemQbKey qbk = (QbItemQbKey)qb;
                        if (qbk.Values[0].Crc == qkEndOrig.Crc || qbk.Values[0].Crc == qkEndTG.Crc)
                            qbk.Values[0] = qkEndNew;
                    }
                    return false;
                });

            QbItemBase qibUnlock = findTierProgStruct(QbKey.Create("career_unlock_unlockedsongs"), coopSongsProg);

            //edit to set end unlock info.  We hack this to just point to the last tier (so we can allow GH3 to have 1 toer if required)
            qibUnlock.FindItem(true, delegate(QbItemBase qb)
                {
                    if (qb.ItemQbKey != null && qb.ItemQbKey.Crc == qkTier.Crc)
                        ((QbItemInteger)qb).Values[0] = (uint)currTierCount; //point to the last tier
                    return false;
                });

            //insert new entries
            for (int i = 1; i <= currTierCount; i++)
            {
                for (int c = 0; c < masks.Length; c++)
                {
                    QbItemBase qib = findTierProgStruct(QbKey.Create(string.Format(masks[c], i.ToString())), careerSongsProg);
                    if (qib == null)
                        continue;

                    qib = qib.Clone();

                    qib.FindItem(true, delegate(QbItemBase qb)
                        {
                            if (qb.ItemQbKey != null && qb.ItemQbKey.Crc == qkNumSongs.Crc)
                                ((QbItemQbKey)qb).Values[0] = qkCoopNumSongs.Clone();
                            return false;
                        });

                    coopSongsProg.Items[0].InsertItem(qib, qibUnlock, true);

                }
            }

            #endregion

            coopQb.AlignPointers();
            coopQb.IsValid();
        }
Exemple #13
0
        private static void addSongToSonglist(QbFile qbSongList, QbKey qkSong)
        {
            QbItemStruct songs = qbSongList.FindItem(QbKey.Create("permanent_songlist_props"), false) as QbItemStruct;
            QbItemArray songsList = qbSongList.FindItem(QbKey.Create("gh3_songlist"), false) as QbItemArray;
            if (songsList != null)
            {
                List<QbKey> songlistQk = new List<QbKey>(((QbItemQbKey)songsList.Items[0]).Values);

                if (!songlistQk.Contains(qkSong))
                {
                    songs.AddItem((QbItemBase)SongQb.CreateSong(songs.Root, qkSong.Text));
                    songlistQk.Add(qkSong);
                }

                //update gh3_songlist
                ((QbItemQbKey)songsList.Items[0]).Values = songlistQk.ToArray();

                qbSongList.AlignPointers();
                qbSongList.IsValid();
            }
        }
Exemple #14
0
 public void SetCheats(QbFile menuCheatsQb)
 {
     if (_project.GameInfo.Game == Game.GH3_Wii || _project.GameInfo.Game == Game.GHA_Wii)
     {
         //edit the cheats
         uint t = 0x00010000;
         uint f = 0x00011000;
         bool b = true;
         menuCheatsQb.FindItem(true, delegate(QbItemBase qib)
         {
             if (qib.QbItemType == QbItemType.StructItemArray && qib.ItemQbKey == QbKey.Create("unlock_pattern"))
             {
                 uint[] ui = new uint[1];
                 if (b)
                 {
                     ui[0] = t;
                     t >>= 4;
                 }
                 else
                 {
                     ui[0] = f;
                     f >>= 4;
                 }
                 b = !b;
                 ((QbItemInteger)qib.Items[0]).Values = ui;
             }
             return false;
         });
         menuCheatsQb.AlignPointers();
         menuCheatsQb.IsValid();
     }
 }
Exemple #15
0
        public void ResetBonusInfoText(QbFile storeDataQb, string infoText)
        {
            if (_project.GameInfo.Game == Game.GH3_Wii || _project.GameInfo.Game == Game.GHA_Wii)
            {
                QbItemArray qa = storeDataQb.FindItem(QbKey.Create("Bonus_Songs_Info"), false) as QbItemArray;

                if (qa != null)
                {
                    //set all prices to 0
                    QbKey info = QbKey.Create("text");
                    qa.FindItem(true, delegate(QbItemBase qib)
                    {
                        if (qib.ItemQbKey != null && qib.ItemQbKey.Crc == info.Crc)
                            ((QbItemString)qib).Strings[0] = infoText;
                        return false; //loop until end of qb
                    });

                    storeDataQb.AlignPointers();
                    storeDataQb.IsValid();
                }
            }
        }
Exemple #16
0
        internal List<TierQb> BuildTierList(QbFile fileQb, QbKey tiersQk)
        {
            List<TierQb> tierList = new List<TierQb>();

            QbItemBase tiersQi = fileQb.FindItem(tiersQk, false);

            if (tiersQi != null)
            {
                tiersQi.FindItem(false, delegate(QbItemBase item)
                {
                    if (item.QbItemType == QbItemType.StructItemStruct)
                        tierList.Add(new TierQb((QbItemStruct)item));
                    return false; //if we return false then the search continues
                });
            }

            foreach (TierQb t in tierList)
            {
                for (int i = 0; i < t.Songs.Length; i++)
                {
                    if (this.Songs.ContainsKey(t.Songs[i].Crc))
                        t.Songs[i] = this.Songs[t.Songs[i].Crc].SongQb.Id; //get the key from the songlist (it has the text)
                }
            }

            return tierList;
        }