예제 #1
0
        private bool _updateAffectsAudio; //set to true when a change required the audio to be updated (to be safe)

        #endregion Fields

        #region Constructors

        internal ProjectSongNotes(Project project, ProjectSong song)
        {
            _lastChanged = DateTime.MinValue;
            _recordChange = false;

            _project = project;
            _song = song;
            _baseFile = null;
            _updateAffectsAudio = false;

            string songName = _song.SongQb.Id.Text;

            _ghItems = new List<GhNotesItem>();
            _files = new List<NotesFile>();

            _ghItems.Add(new GhNotesItem("Easy", NotesType.Guitar, NotesDifficulty.Easy, songName));
            _ghItems.Add(new GhNotesItem("Medium", NotesType.Guitar, NotesDifficulty.Medium, songName));
            _ghItems.Add(new GhNotesItem("Hard", NotesType.Guitar, NotesDifficulty.Hard, songName));
            _ghItems.Add(new GhNotesItem("Expert", NotesType.Guitar, NotesDifficulty.Expert, songName));
            _ghItems.Add(new GhNotesItem("Easy Rhythm", NotesType.Rhythm, NotesDifficulty.Easy, songName));
            _ghItems.Add(new GhNotesItem("Medium Rhythm", NotesType.Rhythm, NotesDifficulty.Medium, songName));
            _ghItems.Add(new GhNotesItem("Hard Rhythm", NotesType.Rhythm, NotesDifficulty.Hard, songName));
            _ghItems.Add(new GhNotesItem("Expert Rhythm", NotesType.Rhythm, NotesDifficulty.Expert, songName));
            //_ghItems.Add(new GhNotesItem("Easy Co Op", NotesType.GuitarCoop, NotesDifficulty.Easy, songName));
            //_ghItems.Add(new GhNotesItem("Medium Co Op", NotesType.GuitarCoop, NotesDifficulty.Medium, songName));
            //_ghItems.Add(new GhNotesItem("Hard Co Op", NotesType.GuitarCoop, NotesDifficulty.Hard, songName));
            //_ghItems.Add(new GhNotesItem("Expert Co Op", NotesType.GuitarCoop, NotesDifficulty.Expert, songName));
            //_ghItems.Add(new GhNotesItem("Easy Rhythm Co Op", NotesType.RhythmCoop, NotesDifficulty.Easy, songName));
            //_ghItems.Add(new GhNotesItem("Medium Rhythm Co Op", NotesType.RhythmCoop, NotesDifficulty.Medium, songName));
            //_ghItems.Add(new GhNotesItem("Hard Rhythm Co Op", NotesType.RhythmCoop, NotesDifficulty.Hard, songName));
            //_ghItems.Add(new GhNotesItem("Expert Rhythm Co Op", NotesType.RhythmCoop, NotesDifficulty.Expert, songName));
        }
예제 #2
0
파일: GameMods.cs 프로젝트: Nanook/TheGHOST
        internal GameMods(Project project)
        {
            _project = project;
            _restoreSongs = new List<QbKey>();
            _nonCareerSongs = new List<QbKey>();
            _specialSongs = new List<QbKey>();

            if (project.GameInfo.Game == Game.GH3_Wii)
            {
                foreach (string s in "slowride,TalkDirtyToMe,hitmewithyourbestshot,storyofmylife,rocknrollallnite,mississippiqueen,schoolsout,sunshineofyourlove,barracuda,bullsonparade,whenyouwereyoung,missmurder,theseeker,laydown,paintitblack,paranoid,anarchyintheuk,koolthing,mynameisjonas,evenflow,holidayincambodia,rockulikeahurricane,sameoldsonganddance,lagrange,welcometothejungle,blackmagicwoman,cherubrock,blacksunshine,themetal,pridenjoy,beforeiforget,stricken,threesandsevens,knightsofcydonia,cultofpersonality,rainingblood,cliffsofdover,numberofthebeast,one,avalancha,bellyofashark,cantbesaved,closer,dontholdback,downndirty,fcpremix,generationrock,gothatfar,hierkommtalex,imintheband,impulse,inlove,mauvaisgarcon,metalheavylady,minuscelsius,mycurse,nothingformehere,prayeroftherefugee,radiosong,ruby,shebangsadrum,takethislife,thewayitends".Split(','))
                    _restoreSongs.Add(QbKey.Create(s));
                foreach (string s in "sabotage,reptilia,suckmykiss,citiesonflame,helicopter,monsters".Split(','))
                    _nonCareerSongs.Add(QbKey.Create(s));
                foreach (string s in "thrufireandflames".Split(','))
                    _specialSongs.Add(QbKey.Create(s));

            }
            else
            {
                foreach (string s in "dreampolice,alltheyoungdudes,makeit,unclesalty,drawtheline,ihatemyselfforlovingyou,alldayandallofthenight,nosurprize,movinout,sweetemotion,completecontrol,personalitycrisis,livinontheedge,ragdoll,loveinanelevator,shesellssanctuary,kingofrock,nobodysfault,brightlightfright,walkthiswayrundmc,hardtohandle,alwaysontherun,backinthesaddle,beyondbeautiful,dreamon,catscratchfever,sextypething,mamakin,toysintheattic,trainkeptarollin,walkthisway,ratsinthecellar,combination,letthemusicdothetalking,shakinmycage,pink,talktalking,mercy,pandorasbox,joeperryguitarbattle".Split(','))
                    _restoreSongs.Add(QbKey.Create(s));
                //foreach (string s in "kingsandqueens,kingsandqueenscredits".Split(','))
                //    _nonCareerSongs.Add(QbKey.Create(s));
                foreach (string s in "kingsandqueens,kingsandqueenscredits".Split(','))
                    _specialSongs.Add(QbKey.Create(s));

            }
        }
예제 #3
0
 public ModsScreen()
 {
     InitializeComponent();
     _project = null;
     _lastAudioLen = 0;
     _settingVolume = false;
     tmrPreview.Enabled = false;
     tmrPreview.Interval = 500;
     _startVolumes = null;
 }
예제 #4
0
        internal ProjectSong(Project project, SongQb songQb)
        {
            _lastChanged = DateTime.MinValue;
            _qbLastChanged = DateTime.MinValue;
            _recordChange = false;

            _project = project;
            _songQb = songQb;
            _artist = this.SongQb.Artist;
            _title = this.SongQb.Title;

            if (_project.Defaults.SongVolumeMode == DefaultSettingMode.Game)
                _year = this.SongQb.Year;
            else
                _year = _project.Defaults.Year;

            if (_project.Defaults.SongVolumeMode == DefaultSettingMode.Game)
                _songVolume = this.SongQb.SongVolume;
            else
                _songVolume = _project.Defaults.SongVolume;

            if (_project.Defaults.GuitarVolumeMode == DefaultSettingMode.Game)
                _guitarVolume = this.SongQb.GuitarVolume;
            else
                _guitarVolume = _project.Defaults.GuitarVolume;

            if (_project.Defaults.SingerMode == DefaultSettingMode.Game)
                _singer = this.SongQb.Singer;
            else
                _singer = _project.Defaults.Singer;

            _originalArtist = true; // this.Song.OriginalArtist;

            _minMsBeforeNotesStart = _project.Defaults.MinMsBeforeNotesStart;
            _startPaddingMs = 0;

            _audio = new ProjectSongAudio(_project, this);
            _notes = new ProjectSongNotes(_project, this);

            _audio.PreviewFadeLength = _project.Defaults.PreviewFadeLength;
            _audio.PreviewLength = _project.Defaults.PreviewLength;
            _audio.PreviewStart = _project.Defaults.PreviewStart;
            _audio.PreviewVolume = _project.Defaults.PreviewVolume;
            _audio.PreviewIncludeGuitar = _project.Defaults.PreviewIncludeGuitar;
            _audio.PreviewIncludeRhythm = _project.Defaults.PreviewIncludeRhythm;

            _notes.HoPoMeasure = _project.Defaults.HoPoMeasure;
            _notes.Gh3SustainClipping = _project.Defaults.Gh3SustainClipping;
            _notes.ForceNoStarPower = _project.Defaults.ForceNoStarPower;
        }
예제 #5
0
        internal FileManager(Project project, IPluginFileCopy fileCopyPlugin, string gameLocation)
        {
            _pakFormat = null;
            _pakEditor = null;
            _dbgEditor = null;

            _songListQbFile = null;
            _guitarProgressionQbFile = null;

            _project = project;
            _files = new Dictionary<string, GameFile>();
            _fileCopy = fileCopyPlugin;
            _gameLocation = gameLocation;
            _backgroundAudioDatWad = null;
        }
예제 #6
0
        internal ProjectSettingsGameMods(Project project)
        {
            _recordChange = false;
            _lastChanged = DateTime.MinValue;

            _tierNames = new List<string>();
            _project = project;

            _unlockSetlists = false;
            _completeTier1Song = false;
            _addNonCareerTracksToBonus = false;
            _setCheats = false;
            _freeStore = false;
            _defaultBonusSongInfo = false;
            _tiersTested = false;
        }
예제 #7
0
        public ProjectBackgroundAudio(Project project, DatWad datWad, DatItem datItem)
        {
            _lastChanged = DateTime.MinValue;
            _lastApplied = DateTime.MinValue;
            _previewLastCreated = DateTime.MinValue;
            _recordChange = false;

            if (_names == null)
            {
                _names = new Dictionary<string, string>();
                _names.Add("menbulls.wav", "Rage Against the Machine - Bulls on Parade");
                _names.Add("menfrget.wav", "Slipknot - Before I Forget");
                _names.Add("menjungl.wav", "Guns N Roses - Welcome to the Jungle");
                _names.Add("menpaint.wav", "The Rolling Stones - Paint It Black");
                _names.Add("menevenf.wav", "Pearl Jam - Even Flow");
                _names.Add("menmonst.wav", "Matchbook Romance - Monsters");
                _names.Add("menswte.wav ", "Aerosmith - Sweet Emotion");
                _names.Add("menmama.wav ", "Aerosmith - Mama Kin");
                _names.Add("menlove.wav ", "Aerosmith - Love in an Elavator");
                _names.Add("menragd.wav ", "Aerosmith - Rag Doll");
                _names.Add("mentoys.wav ", "Aerosmith - Toys In The Atic");
                _names.Add("menwalk.wav ", "Aerosmith - Walk This Way");
            }

            _name = _names[datWad.ReadInternalFileName(datItem)];
            _project = project;
            _datWad = datWad;
            _datItem = datItem;
            _audioFiles = new AudioFileList(this.AudioFileListChanged, _project);
            _rawFiles = new Dictionary<string, string>();
            _rawLengths = new Dictionary<string, int>();

            string mask = @"{0}\{1}.wav";
            _compressedAudioFile = string.Format(mask, _project.GetWorkingPath(WorkingFileType.Compressed), this.Name);

            mask = @"{0}\{1}.raw.wav";
            _rawAudioFile = string.Format(mask, _project.GetWorkingPath(WorkingFileType.RawWav), this.Name);
        }
예제 #8
0
        internal ProjectSettings(string projectFile, Project project)
        {
            _project = project;
            _projectFile = projectFile;

            _tierNames = new List<string>();

            if (File.Exists(_projectFile))
            {
                XmlReaderSettings xmlS = new XmlReaderSettings();
                xmlS.IgnoreComments = true;
                xmlS.IgnoreProcessingInstructions = true;
                xmlS.IgnoreWhitespace = true;

                using (XmlReader xml = XmlReader.Create(_projectFile, xmlS))
                {

                    while (!xml.EOF && xml.Read())
                    {
                        if (xml.Name == "xml")
                            break;
                    }

                    while (!xml.EOF && xml.Read())
                    {
                        if (xml.Name == "TheGHOST_ProjectSettings")
                        {
                            try
                            {
                                #region TheGHOST_ProjectSettings
                                string version = xml.GetAttribute("version");
                                if (version == "1")
                                {
                                    _project.StoreProjectFiles = bool.Parse(xml.GetAttribute("storeFiles"));

                                    while (!xml.EOF && xml.Read())
                                    {
                                        switch (xml.Name)
                                        {
                                            case "Plugins":
                                                #region Plugins
                                                while (!xml.EOF && xml.Read())
                                                {
                                                    if (xml.NodeType == XmlNodeType.Element)
                                                    {
                                                        switch (xml.Name)
                                                        {
                                                            case "AudioExportPlugin":
                                                                this.AudioExportPluginName = xml.ReadString();
                                                                break;

                                                            case "AudioImportPlugin":
                                                                this.AudioImportPluginName = xml.ReadString();
                                                                break;

                                                            case "FileCopyPlugin":
                                                                this.FileCopyPluginName = xml.ReadString();
                                                                break;

                                                            case "EditorPlugins":
                                                                break;
                                                        }
                                                    }
                                                    else if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "Plugins")
                                                        break;
                                                }
                                                #endregion
                                                break;

                                            case "Settings":
                                                #region Settings
                                                this.GameId = xml.GetAttribute("game");
                                                this.LanguageId = xml.GetAttribute("language");

                                                while (!xml.EOF && xml.Read())
                                                {
                                                    if (xml.NodeType == XmlNodeType.Element)
                                                    {
                                                        switch (xml.Name)
                                                        {
                                                            case "SourcePath":
                                                                this.SourcePath = xml.ReadString();
                                                                break;
                                                        }
                                                    }
                                                    else if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "Settings")
                                                        break;
                                                }
                                                #endregion
                                                break;

                                            case "Defaults":
                                                #region Defaults
                                                _project.Defaults.HoPoMeasure = float.Parse(xml.GetAttribute("hammerOnMeasure"));
                                                _project.Defaults.GuitarVolume = float.Parse(xml.GetAttribute("guitarVolume"));
                                                _project.Defaults.GuitarVolumeMode = (DefaultSettingMode)Enum.Parse(typeof(DefaultSettingMode), xml.GetAttribute("guitarVolumeMode"));
                                                _project.Defaults.MinMsBeforeNotesStart = int.Parse(xml.GetAttribute("minMsBeforeNotesStart"));
                                                _project.Defaults.SmartModeCrowdImport = bool.Parse(xml.GetAttribute("smartModeCrowdImport"));
                                                _project.Defaults.ForceMono = (xml.GetAttribute("forceMono") == null) ? _project.Defaults.ForceMono : bool.Parse(xml.GetAttribute("forceMono"));
                                                _project.Defaults.ForceDownSample = (xml.GetAttribute("forceDownSample") == null) ? _project.Defaults.ForceDownSample : int.Parse(xml.GetAttribute("forceDownSample"));
                                                _project.Defaults.PreviewFadeLength = int.Parse(xml.GetAttribute("previewFadeLength"));
                                                _project.Defaults.PreviewIncludeGuitar = bool.Parse(xml.GetAttribute("previewIncludeGuitar"));
                                                _project.Defaults.PreviewIncludeRhythm = bool.Parse(xml.GetAttribute("previewIncludeRhythm"));
                                                _project.Defaults.PreviewLength = int.Parse(xml.GetAttribute("previewLength"));
                                                _project.Defaults.PreviewStart = int.Parse(xml.GetAttribute("previewStart"));
                                                _project.Defaults.PreviewVolume = int.Parse(xml.GetAttribute("previewVolume"));
                                                _project.Defaults.AudioSongVolume = (xml.GetAttribute("audioSongVolume") == null) ? _project.Defaults.AudioSongVolume : int.Parse(xml.GetAttribute("audioSongVolume"));
                                                _project.Defaults.AudioGuitarVolume = (xml.GetAttribute("audioGuitarVolume") == null) ? _project.Defaults.AudioGuitarVolume : int.Parse(xml.GetAttribute("audioGuitarVolume"));
                                                _project.Defaults.AudioRhythmVolume = (xml.GetAttribute("audioRhythmVolume") == null) ? _project.Defaults.AudioRhythmVolume : int.Parse(xml.GetAttribute("audioRhythmVolume"));
                                                _project.Defaults.Singer = (Singer)Enum.Parse(typeof(Singer), xml.GetAttribute("singer"));
                                                _project.Defaults.SingerMode = (DefaultSettingMode)Enum.Parse(typeof(DefaultSettingMode), xml.GetAttribute("singerMode"));
                                                _project.Defaults.SongVolume = float.Parse(xml.GetAttribute("songVolume"));
                                                _project.Defaults.SongVolumeMode = (DefaultSettingMode)Enum.Parse(typeof(DefaultSettingMode), xml.GetAttribute("songVolumeMode"));
                                                _project.Defaults.Year = xml.GetAttribute("year");
                                                _project.Defaults.YearMode = (DefaultSettingModeBlank)Enum.Parse(typeof(DefaultSettingModeBlank), xml.GetAttribute("yearMode"));
                                                _project.Defaults.Gh3SustainClipping = bool.Parse(xml.GetAttribute("gh3SustainClipping"));
                                                _project.Defaults.ForceNoStarPower = (xml.GetAttribute("forceNoStarPower") == null) ? _project.Defaults.ForceNoStarPower : bool.Parse(xml.GetAttribute("forceNoStarPower"));
                                                #endregion
                                                break;
                                            #region Loaded later
                                            case "QbMods":
                                                #region QbMods
                                                if (xml.GetAttribute("addNonCareerTracksToBonus") != null) //version change renamed this value
                                                    _project.GameModsSettings.AddNonCareerTracksToBonus = bool.Parse(xml.GetAttribute("addNonCareerTracksToBonus"));
                                                else
                                                    _project.GameModsSettings.AddNonCareerTracksToBonus = bool.Parse(xml.GetAttribute("addCoOpTracksToBonus"));
                                                if (xml.GetAttribute("unlockSetlists") != null) //version change renamed this value
                                                    _project.GameModsSettings.UnlockSetlists = bool.Parse(xml.GetAttribute("unlockSetlists"));
                                                else
                                                    _project.GameModsSettings.UnlockSetlists = bool.Parse(xml.GetAttribute("unlockCareerTiers"));
                                                _project.GameModsSettings.CompleteTier1Song = bool.Parse(xml.GetAttribute("completeTier1Song"));
                                                _project.GameModsSettings.DefaultBonusSongArt = bool.Parse(xml.GetAttribute("defaultBonusSongArt"));
                                                _project.GameModsSettings.FreeStore = bool.Parse(xml.GetAttribute("freeStore"));
                                                _project.GameModsSettings.SetCheats = bool.Parse(xml.GetAttribute("setCheats"));
                                                if (xml.GetAttribute("defaultBonusSongInfo") != null)
                                                {
                                                    _project.GameModsSettings.DefaultBonusSongInfo = bool.Parse(xml.GetAttribute("defaultBonusSongInfo"));
                                                    _project.GameModsSettings.DefaultBonusSongInfoText = xml.GetAttribute("defaultBonusSongInfoText");
                                                }

                                                _project.GameModsSettings.LastApplied = DateTime.Parse(xml.GetAttribute("lastApplied"), null, System.Globalization.DateTimeStyles.AssumeLocal);
                                                DateTime qbModsLastChanged = DateTime.Parse(xml.GetAttribute("lastChanged"), null, System.Globalization.DateTimeStyles.AssumeLocal);

                                                int ti = 0;
                                                while (!xml.EOF && xml.Read())
                                                {
                                                    if (xml.NodeType == XmlNodeType.Element && xml.Name == "TierName" /*&& ti < tc*/) //cater for all tiers doesn't really matter on load
                                                        _project.GameModsSettings.SetTierName(ti++, xml.ReadString());
                                                    else if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "QbMods")
                                                        break;
                                                }
                                                ((ISettingsChange)_project.GameModsSettings).RecordChange();
                                                _project.GameModsSettings.LastChanged = qbModsLastChanged;
                                                #endregion
                                                break;

                                            case "BackgroundMusic":
                                                #region BackgroundMusic
                                                #endregion
                                                break;

                                            case "Songs":
                                                #region Songs
                                                #endregion
                                                break;
                                            #endregion
                                        }
                                    }
                                }
                                else
                                    throw new ApplicationException(string.Format("Version '{0}' project files are not supported", version));

                                #endregion
                            }
                            catch (Exception ex)
                            {
                                throw new ApplicationException(string.Format("Exception loading project: {0}", ex.Message));
                            }
                        }
                        else if (xml.Name == "configuration")
                            throw new ApplicationException("This project format is from an old version and no longer supported");
                        else
                            throw new ApplicationException("This project format is not recognised");
                    }
                }
            }
        }
예제 #9
0
 internal ProjectSettings(Project project)
 {
     _project = project;
     _tierNames = null;
 }
예제 #10
0
 public override void Construct(Project project)
 {
     _project = project;
 }
예제 #11
0
 /// <summary>
 /// Return true=has changed, false=has not changed
 /// </summary>
 //public virtual bool HasChanged()
 //{
 //    throw new NotImplementedException();
 //}
 /// <summary>
 /// The screen is being created
 /// </summary>
 public virtual void Construct(Project project)
 {
     throw new NotImplementedException();
 }
예제 #12
0
 public override void Construct(Project project)
 {
     _project = project;
     _defaults = new ProjectDefaultsProperties(_project.Defaults);
     pgdDefaultSettings.SelectedObject = _defaults;
 }
예제 #13
0
파일: MainForm.cs 프로젝트: Nanook/TheGHOST
        private void btnPrepIso_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(txtWorkingFolder.Text) || !File.Exists(txtIso.Text))
            {
                MessageBox.Show(this, "Input ISO or Working folder not found, drag and drop the ISO and Working Folder on to the text boxes above.", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            readDiscTitle();
            findMainPartition();

            if (!rdbGameGh3.Checked && !rdbGameGhA.Checked)
            {
                MessageBox.Show(this, "No Game selected.", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //TODO enable message somewhere
            //if (_prepProps.EnableTierEditing == YesNo.Yes && (_prepProps.RemoveBossBattles == YesNo.Yes || _prepProps.TierSongsCount.Length != 0 ||  ))
            //{
            //    if (DialogResult.No == MessageBox.Show(this, "Adding more that 48 songs can stop the save file being restored (Tested on GH3)\r\n\r\nAre you sure you want to continue?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            //        return;
            //}

            //shortcuts to make code cleaner
            TheGhostCore core = new TheGhostCore();
            _project = core.Project;
            _plugins = core.PluginManager;

            //set up the project settings
            _project.WorkingPath = txtWorkingFolder.Text;
            _project.SourcePath = txtIso.Text;
            _project.GameId = (rdbGameGh3.Checked ? Game.GH3_Wii : Game.GHA_Wii);   //  or  GameInfo.GameStringToEnum("GH 3 (Wii)");

            _project.SetPlugins(_plugins.AudioImportPlugins["FFMpeg Plugin"],
                                _plugins.AudioExportPlugins["IMA ADPCM Plugin"],
                                _plugins.FileCopyPlugins["Wii Scrubber"]);  //no editor plugins

            _project.LanguageId = GameInfo.LanguageStringToId(cboLanguage.Text);

            bool failed = false;
            try
            {
                _project.FileManager.ImportPaks(null);
            }
            catch
            {
                failed = true;
            }
            if (failed || !_project.FileManager.PakFormat.PakFileExists)
            {
                MessageBox.Show(this, "The selected language does not exist in the ISO or file extraction failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            int calcTierSongs = 0;
            int calcBonuSongs = 0;
            bool calcBossRemove = false;
            bool calcNonCareerMove = false;
            int calcSongsToAdd = 0;

            if (_prepProps.EnableTierEditing == YesNo.Yes)
            {

                if (_prepProps.Tiers != 0 && _prepProps.TierSongsTotalCount == 0)
                {
                    MessageBox.Show(this, "TierSongsCount must be set when setting TierSongs.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (_prepProps.TierSongsTotalCount != 0)
                {
                    foreach (int c in _prepProps.TierSongs)
                    {
                        if (c < 2)
                        {
                            MessageBox.Show(this, "Each Tier must contain at least 2 songs to function correctly with an encore.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                    }
                }

                bool calcTiersChanged;
                int bossSongCount = 0;
                int nonCareerOnlyCount = 0;
                int bonusSongCount = 0;
                int tierSongsCount = 0;
                bool ttfafExists = false; //does TTFAF exist in bonus, are we not editing the tier songs then inc tier counts, dec bonus counts
                bool kingQueenCredExists = false; //does kingsandqueencredits exist in bonus, are we not editing the tier songs then inc tier counts, dec bonus counts

                QbKey ttfafQk = QbKey.Create("thrufireandflames");
                QbKey kingQueenCred = QbKey.Create("kingsandqueenscredits");
                foreach (ProjectTierSong pts in _project.Songs.Values)
                {
                    switch (pts.Tier.Type)
                    {
                        case TierType.Career:
                            if (pts.SongQb.IsBoss)
                                bossSongCount++;
                            tierSongsCount++;
                            break;
                        case TierType.Bonus:
                            if (pts.SongQb.Id.Crc == ttfafQk.Crc)
                                ttfafExists = true;
                            if (pts.SongQb.Id.Crc == kingQueenCred.Crc)
                                kingQueenCredExists = true;
                            bonusSongCount++;
                            break;
                        case TierType.NonCareer:
                            nonCareerOnlyCount++;   //+1 for kingsandqueens in GHA +6 for non career songs
                            break;
                        case TierType.None:
                            break;
                        default:
                            break;
                    }
                }

                calcTierSongs = tierSongsCount; //will be the resulting value when editing the current tiers
                calcBonuSongs = bonusSongCount;

                calcBossRemove = (_prepProps.RemoveBossBattles == YesNo.Yes || _prepProps.TierSongsTotalCount != 0) && bossSongCount != 0;
                calcNonCareerMove = (_prepProps.AddNonCareerTracksToBonus == YesNo.Yes || _prepProps.TierSongsTotalCount != 0 || calcBossRemove) && nonCareerOnlyCount != 0;

                calcTiersChanged = (_prepProps.TierSongsTotalCount != 0 || calcBossRemove);

                if (calcTiersChanged) //if any change then force boss and non career move and copy career to other tier sets
                {
                    calcBossRemove = true;
                    calcNonCareerMove = true;
                }

                if (calcBossRemove)
                {
                    calcTierSongs -= bossSongCount;
                    if (ttfafExists)
                    {
                        calcTierSongs++;
                        calcBonuSongs--;
                    }
                    //if (!kingQueenCredExists && _project.GameInfo.Game == Game.GHA_Wii)
                    //    calcBonuSongs++;
                }

                if (calcNonCareerMove)
                {
                    calcBonuSongs += nonCareerOnlyCount; //+1 for kingsandqueens in GHA +6 for non career songs
                }

                calcSongsToAdd = 0;
                if (_prepProps.TierSongsTotalCount != 0)
                {
                    calcBonuSongs -= _prepProps.TierSongsTotalCount - calcTierSongs; //add or remove the difference from the bonus songs
                    calcTierSongs += _prepProps.TierSongsTotalCount - calcTierSongs;
                }

                if (calcBonuSongs < 1) //too many career songs. add more songs
                {
                    calcSongsToAdd += 1 - calcBonuSongs;
                    calcBonuSongs = 1;
                }

                if (_prepProps.BonusSongs != 0)
                {
                    calcSongsToAdd -= calcBonuSongs - _prepProps.BonusSongs;
                    calcBonuSongs = _prepProps.BonusSongs;
                }

                int existingCareerTiers = 0;
                foreach (ProjectTier t in _project.Tiers)
                {
                    if (t.Type == TierType.Career)
                        existingCareerTiers++;
                }

                if (DialogResult.OK != MessageBox.Show(this, string.Format(
            @"The following tier changes will be made to this ISO:

            {0} boss songs will be removed.{1}{2}
            {3} songs will be added to the bonus songs currently being Non Career/Bonus.{4}

            The career tiers will contain {5} songs{6}.
            The bonus tier will contain {7} songs{8}.

            The Game will contain {9} career tiers with {10} songs in total ({11} will be {12}).

            Remember that setting too many songs can cause the game to crash, read the FAQ for more information.

            Click OK to continue...",
                                           (calcBossRemove ? bossSongCount : 0).ToString(),
                                                   (calcTiersChanged) ? " (Tiers Changed)" : "",
                                                   (calcBossRemove && ttfafExists ? "\r\n    Through The Fire and Flames will be moved from the bonus tier to the career tiers.\r\n    This is because it can no longer be unlocked with out the Devil Battle" : ((calcNonCareerMove || calcBossRemove) && !kingQueenCredExists && _project.GameInfo.Game == Game.GHA_Wii ? "\r\n    Kings And Queen (End Credits Version) will be added as the last bonus song." : "")),
                                           (calcNonCareerMove ? nonCareerOnlyCount : 0).ToString(),
                                                   (calcTiersChanged) ? " (Tiers Changed)" : "",
                                           calcTierSongs.ToString(),
                                                   !calcTiersChanged ? " (no change)" : "",
                                           calcBonuSongs.ToString(),
                                                   (!calcTiersChanged && _prepProps.BonusSongs == 0) ? " (no change)" : "",
                                           _prepProps.Tiers != 0 ? _prepProps.Tiers.ToString() : existingCareerTiers.ToString(),
                                                   (calcTierSongs + calcBonuSongs).ToString(),
                                                   Math.Abs(calcSongsToAdd).ToString(),
                                                   (calcSongsToAdd < 0) ? "removed" : "added"
                   ), "ISO Songs", MessageBoxButtons.OKCancel, MessageBoxIcon.Information))
                    return;

            }

            _shrinkPrgSize = 1;

            lblStatus.Text = "Replacing Audio";
            lblStatus.Update();

            btnPrepIso.Enabled = false;
            pgdPrep.Enabled = false;
            cboPresets.Enabled = false;
            cboLanguage.Enabled = false;
            btnPreset.Enabled = false;
            btnDiscIdSet.Enabled = false;
            btnTitleRead.Enabled = false;
            btnTitleWrite.Enabled = false;

            try
            {

                foreach (ProjectTierSong pts in _project.Songs.Values)
                {
                    pts.IsEditSong = false; //reset any edit flags
                    pts.Song = null;
                }

                if (_prepProps.EnableAudioBlanking != YesNo.Yes)
                {
                    prg.Visible = true;
                    prg.Minimum = 0;
                    _shrinkPrgSize = 1; //make the progress bar display better portions for scrubbing
                    prg.Maximum = 6;  //Extract files, build ISO, edit things, replace partition
                    prg.Value = 0;
                    Application.DoEvents();
                }
                else
                {

                    if (_prepProps.BlankTierSongs == YesNo.Yes || _prepProps.BlankBattles == YesNo.Yes)
                    {
                        foreach (ProjectTier pt in _project.Tiers)
                        {
                            if (pt.Type == TierType.Career)
                            {
                                foreach (ProjectTierSong pts in pt.Songs)
                                {
                                    if (((!pts.SongQb.IsBoss && _prepProps.BlankTierSongs == YesNo.Yes) || (pts.SongQb.IsBoss && _prepProps.BlankBattles == YesNo.Yes)) && !pts.IsAddedWithTheGhost)
                                        setEditSong(pts);
                                }
                            }
                        }
                    }

                    if (_prepProps.BlankBonus == YesNo.Yes || _prepProps.BlankBattles == YesNo.Yes)
                    {
                        foreach (ProjectTier pt in _project.Tiers)
                        {
                            if (pt.Type == TierType.Bonus)
                            {
                                foreach (ProjectTierSong pts in pt.Songs)
                                {
                                    if (((!pts.SongQb.IsBoss && _prepProps.BlankBonus == YesNo.Yes) || (pts.SongQb.IsBoss && _prepProps.BlankBattles == YesNo.Yes)) && !pts.IsAddedWithTheGhost)
                                        setEditSong(pts);
                                }
                            }
                        }
                    }

                    if (_prepProps.BlankAddedSongs == YesNo.Yes || _prepProps.BlankBattles == YesNo.Yes)
                    {
                        foreach (ProjectTier pt in _project.Tiers)
                        {
                            foreach (ProjectTierSong pts in pt.Songs)
                            {
                                if (pts.IsAddedWithTheGhost && ((!pts.SongQb.IsBoss && _prepProps.BlankAddedSongs == YesNo.Yes) || (pts.SongQb.IsBoss && _prepProps.BlankBattles == YesNo.Yes)))
                                    setEditSong(pts);
                            }
                        }
                    }

                    if (_prepProps.BlankNonCareerSongs == YesNo.Yes || _prepProps.BlankBattles == YesNo.Yes)
                    {
                        foreach (ProjectTier pt in _project.Tiers)
                        {
                            if (pt.Type == TierType.NonCareer)
                            {
                                foreach (ProjectTierSong pts in pt.Songs)
                                {
                                    if (((!pts.SongQb.IsBoss && _prepProps.BlankNonCareerSongs == YesNo.Yes) || (pts.SongQb.IsBoss && _prepProps.BlankBattles == YesNo.Yes)) && !pts.IsAddedWithTheGhost)
                                        setEditSong(pts);
                                }
                            }
                        }
                    }

                    prg.Visible = true;
                    prg.Minimum = 0;
                    _shrinkPrgSize = _project.EditSongs.Length; //make the progress bar display better portions for scrubbing
                    prg.Maximum = (_project.EditSongs.Length * 4) + (_shrinkPrgSize * 6); //*2=this loop and next, *4=File copy ImpNotesPAK, ExpNotesPAK, ExpDat, ExpWad +1 ExpQBPAK
                    prg.Value = 0;
                    Application.DoEvents();

                    replaceAudio();
                }

                replaceDataPartition(calcSongsToAdd, calcNonCareerMove, calcBossRemove, calcBonuSongs, _prepProps.TierSongs);

                lblStatus.Text = "Complete";

                MessageBox.Show(this, "Complete", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
            finally
            {
                btnPrepIso.Enabled = true;
                pgdPrep.Enabled = true;
                cboPresets.Enabled = true;
                cboLanguage.Enabled = true;
                btnPreset.Enabled = true;
                btnDiscIdSet.Enabled = true;
                btnTitleRead.Enabled = true;
                btnTitleWrite.Enabled = true;
            }
        }
예제 #14
0
파일: SongQb.cs 프로젝트: Nanook/TheGHOST
        internal SongQb(Project project, QbItemStruct song)
        {
            _song = song;
            QbItemBase temp;

            _hopoMeasure = null;

            _checksum = (QbItemQbKey)song.FindItem(QbKey.Create("checksum"), false);
            //_key = song.ItemQbKey;
            _key = QbKey.Create(((QbItemString)song.FindItem(QbKey.Create("name"), false)).Strings[0]);

            _title = (QbItemString)song.FindItem(QbKey.Create("title"), false);
            _artist = (QbItemString)song.FindItem(QbKey.Create("artist"), false);

            _leaderboard = (QbItemInteger)song.FindItem(QbKey.Create("leaderboard"), false);
            _year = (QbItemString)song.FindItem(QbKey.Create("year"), false);

            _boss = song.FindItem(QbKey.Create("boss"), false) as QbItemQbKey;  //is this a boss

            temp = song.FindItem(QbKey.Create("band_playback_volume"), false);  //sometimes integer instead of float
            if (temp == null)
            {
                _songVolume = new QbItemFloat(song.Root);
                _songVolume.Create(QbItemType.StructItemFloat);
                _songVolume.ItemQbKey = QbKey.Create("band_playback_volume");
                _songVolume.Values = new float[1];
                _songVolume.Values[0] = 0;
                song.AddItem(_songVolume);
                song.Root.AlignPointers();
            }
            else if (temp is QbItemInteger)
                _songVolume = replaceItemIntForFloat(song, (QbItemInteger)temp);
            else
                _songVolume = (QbItemFloat)temp;

            temp = song.FindItem(QbKey.Create("guitar_playback_volume"), false);  //sometimes integer instead of float
            if (temp == null)
            {
                _guitarVolume = new QbItemFloat(song.Root);
                _guitarVolume.Create(QbItemType.StructItemFloat);
                _guitarVolume.ItemQbKey = QbKey.Create("guitar_playback_volume");
                _guitarVolume.Values = new float[1];
                _guitarVolume.Values[0] = 0;
                song.AddItem(_guitarVolume);
                song.Root.AlignPointers();
            }
            else if (temp is QbItemInteger)
                _guitarVolume = replaceItemIntForFloat(song, (QbItemInteger)temp);
            else
                _guitarVolume = (QbItemFloat)temp;

            _rhythmTrack = (QbItemInteger)song.FindItem(QbKey.Create("rhythm_track"), false);

            temp = song.FindItem(QbKey.Create("artist_text"), false);
            if (temp is QbItemString)
            {
                _artistTextString = (QbItemString)temp;
                _artistText = null;
            }
            else
            {
                _artistText = song.FindItem(QbKey.Create("artist_text"), false) as QbItemQbKey;
                _artistTextString = null;
            }

            _originalArtist = (QbItemInteger)song.FindItem(QbKey.Create("original_artist"), false);

            temp = song.FindItem(QbKey.Create("singer"), false);
            if (temp == null) //GH3 wii Cream sunshine for your love has no singer item
            {
                _singer = new QbItemQbKey(song.Root);
                _singer.Create(QbItemType.StructItemQbKey);
                _singer.ItemQbKey = QbKey.Create("singer");
                _singer.Values = new QbKey[1];
                _singer.Values[0] = QbKey.Create("male");
                song.AddItem(_singer);
                song.Root.AlignPointers();
            }
            else
                _singer = (QbItemQbKey)temp;

            _fretbarOffset = song.FindItem(QbKey.Create("fretbar_offset"), false) as QbItemInteger;
            _gemOffset = song.FindItem(QbKey.Create("gem_offset"), false) as QbItemInteger;
            _inputOffset = song.FindItem(QbKey.Create("input_offset"), false) as QbItemInteger;

            //this fixes an issue with GH3(cult of personality) and GHA (talk talking)
            if (this.key.Crc != this.checksum.Crc)
                _id = (project.GameInfo.Game == Game.GH3_Wii) ? this.checksum : this.key;
            else
                _id = this.checksum.HasText ? this.checksum : this.key;
        }
예제 #15
0
 public TheGhostCore()
 {
     _project = new Project(this);
     _pluginManager = null;
 }