Esempio n. 1
0
        private static void LoadDataFromBytes(
            IList <byte> abilities, IList <byte> abilityEffects, IList <byte> itemAbilityEffects, IList <byte> reactionEffects, IList <byte> abilityAnimations,
            IList <byte> oldItems, IList <byte> oldItemAttributes,
            IList <byte> newItems, IList <byte> newItemAttributes,
            IList <byte> jobs, IList <byte> jobLevels,
            IList <byte> skillSets, IList <byte> monsterSkills,
            IList <byte> actionMenus,
            IList <byte> statusAttributes, IList <byte> inflictStatuses,
            IList <byte> poach,
            IList <byte> entd1, IList <byte> entd2, IList <byte> entd3, IList <byte> entd4, IList <byte> entd5,
            IList <byte> moveFind,
            IList <byte> inventories,
            IList <byte> propositions, bool brokenLevelBonuses)
        {
            try
            {
                bool psp               = Context == Context.US_PSP;
                var  Abilities         = new AllAbilities(abilities, abilityEffects, itemAbilityEffects, reactionEffects);
                var  AbilityAnimations = new AllAnimations(Context, abilityAnimations, psp ? PSPResources.Binaries.AbilityAnimations : PSXResources.Binaries.AbilityAnimations);
                var  Items             = new AllItems(oldItems, newItems != null ? newItems : null);
                var  ItemAttributes    = new AllItemAttributes(oldItemAttributes, newItemAttributes != null ? newItemAttributes : null);
                var  Jobs              = new AllJobs(Context, jobs);
                var  JobLevels         = new JobLevels(Context, jobLevels,
                                                       new JobLevels(Context, Context == Context.US_PSP ? PSPResources.Binaries.JobLevels : PSXResources.Binaries.JobLevels));
                var SkillSets = new AllSkillSets(Context, skillSets,
                                                 Context == Context.US_PSP ? PSPResources.Binaries.SkillSets : PSXResources.Binaries.SkillSets);
                var MonsterSkills      = new AllMonsterSkills(monsterSkills);
                var ActionMenus        = new AllActionMenus(actionMenus, Context);
                var StatusAttributes   = new AllStatusAttributes(statusAttributes);
                var InflictStatuses    = new AllInflictStatuses(inflictStatuses);
                var PoachProbabilities = new AllPoachProbabilities(poach);
                var ENTDs            = psp ? new AllENTDs(entd1, entd2, entd3, entd4, entd5) : new AllENTDs(entd1, entd2, entd3, entd4);
                var MoveFind         = new AllMoveFindItems(Context, moveFind, new AllMoveFindItems(Context, psp ? PSPResources.Binaries.MoveFind : PSXResources.Binaries.MoveFind));
                var StoreInventories = new AllStoreInventories(Context, inventories, psp ? PSPResources.Binaries.StoreInventories : PSXResources.Binaries.StoreInventories);
                var Propositions     = new AllPropositions(propositions, psp ? PSPResources.Binaries.Propositions : PSXResources.Binaries.Propositions, brokenLevelBonuses);
                FFTPatch.Propositions = Propositions;

                FFTPatch.Abilities         = Abilities;
                FFTPatch.AbilityAnimations = AbilityAnimations;
                FFTPatch.Items             = Items;
                FFTPatch.ItemAttributes    = ItemAttributes;
                FFTPatch.Jobs               = Jobs;
                FFTPatch.JobLevels          = JobLevels;
                FFTPatch.SkillSets          = SkillSets;
                FFTPatch.MonsterSkills      = MonsterSkills;
                FFTPatch.ActionMenus        = ActionMenus;
                FFTPatch.StatusAttributes   = StatusAttributes;
                FFTPatch.InflictStatuses    = InflictStatuses;
                FFTPatch.PoachProbabilities = PoachProbabilities;
                FFTPatch.ENTDs              = ENTDs;
                FFTPatch.MoveFind           = MoveFind;
                FFTPatch.StoreInventories   = StoreInventories;
            }
            catch (Exception)
            {
                throw new LoadPatchException();
            }
        }
Esempio n. 2
0
        public EventUnit(IList <byte> bytes, EventUnit defaults, PatcherLib.Datatypes.Context context)
        {
            List <Item> eventItems = Item.GetEventItems(context);

            Ability[] eventAbilities = AllAbilities.GetEventAbilities(context);

            SpriteSet = SpriteSet.GetSpriteSets(context)[bytes[0]];
            Default   = defaults;
            PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[1], ref Male, ref Female, ref Monster, ref JoinAfterEvent, ref LoadFormation, ref ZodiacMonster, ref Blank2, ref SaveFormation);
            SpecialName          = SpecialName.GetSpecialNames(context)[bytes[2]];
            Level                = bytes[3];
            Month                = (Month)bytes[4];
            Day                  = bytes[5];
            Bravery              = bytes[6];
            Faith                = bytes[7];
            PrerequisiteJob      = (PreRequisiteJob)bytes[8];
            PrerequisiteJobLevel = bytes[9];
            Job                  = AllJobs.GetDummyJobs(context)[bytes[10]];
            SecondaryAction      = SkillSet.GetEventSkillSets(context)[bytes[11]];
            Reaction             = eventAbilities[PatcherLib.Utilities.Utilities.BytesToUShort(bytes[12], bytes[13])];
            Support              = eventAbilities[PatcherLib.Utilities.Utilities.BytesToUShort(bytes[14], bytes[15])];
            Movement             = eventAbilities[PatcherLib.Utilities.Utilities.BytesToUShort(bytes[16], bytes[17])];
            Head                 = eventItems[bytes[18]];
            Body                 = eventItems[bytes[19]];
            Accessory            = eventItems[bytes[20]];
            RightHand            = eventItems[bytes[21]];
            LeftHand             = eventItems[bytes[22]];
            Palette              = bytes[23];
            bool dummy = false;

            PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[24], ref AlwaysPresent, ref RandomlyPresent, ref dummy, ref dummy, ref Control, ref Immortal, ref Blank6, ref Blank7);
            TeamColor       = (TeamColor)((bytes[24] & 0x30) >> 4);
            X               = bytes[25];
            Y               = bytes[26];
            FacingDirection = (Facing)(bytes[27] & 0x7F);
            UpperLevel      = (bytes[27] & 0x80) == 0x80;
            Experience      = bytes[28];
            SkillSet        = SkillSet.GetEventSkillSets(context)[bytes[29]];
            WarTrophy       = eventItems[bytes[30]];
            BonusMoney      = bytes[31];
            UnitID          = bytes[32];
            TargetX         = bytes[33];
            TargetY         = bytes[34];

            //Unknown8 = bytes[35];
            PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[35], ref Blank8, ref FocusUnit, ref StayNearXY, ref Aggressive, ref Defensive, ref Blank9, ref Blank10, ref Blank11);

            Target    = bytes[36];
            Unknown10 = bytes[37];

            //Unknown11 = bytes[38];
            PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[38], ref Blank12, ref Blank13, ref Blank14, ref Blank15, ref Blank16, ref SaveCT, ref Blank17, ref Blank18);

            Unknown12 = bytes[39];
        }
        public AllPoachProbabilities(IList <byte> bytes, IList <byte> defaultBytes, Context context)
        {
            defaultBytes = defaultBytes ?? (context == Context.US_PSP ? PSPResources.Binaries.PoachProbabilities : PSXResources.Binaries.PoachProbabilities);

            PoachProbabilities = new PoachProbability[48];
            for (int i = 0; i < 48; i++)
            {
                PoachProbabilities[i] = new PoachProbability(AllJobs.GetNames(context)[i + 0x5E], bytes.Sub(i * 2, i * 2 + 1),
                                                             new PoachProbability(AllJobs.GetNames(context)[i + 0x5E], defaultBytes.Sub(i * 2, i * 2 + 1), context), context);
            }
        }
Esempio n. 4
0
        private static void BuildFromContext()
        {
            switch (Context)
            {
            case Context.US_PSP:
                Abilities         = new AllAbilities(PSPResources.Binaries.Abilities, PSPResources.Binaries.AbilityEffects, PSPResources.Binaries.ItemAbilityEffects, PSPResources.Binaries.ReactionAbilityEffects);
                AbilityAnimations = new AllAnimations(Context, PSPResources.Binaries.AbilityAnimations, PSPResources.Binaries.AbilityAnimations);
                Items             = new AllItems(
                    PSPResources.Binaries.OldItems,
                    PSPResources.Binaries.NewItems);
                ItemAttributes = new AllItemAttributes(
                    PSPResources.Binaries.OldItemAttributes,
                    PSPResources.Binaries.NewItemAttributes);
                Jobs      = new AllJobs(Context, PSPResources.Binaries.Jobs);
                JobLevels = new JobLevels(Context, PSPResources.Binaries.JobLevels,
                                          new JobLevels(Context, PSPResources.Binaries.JobLevels));
                SkillSets = new AllSkillSets(Context, PSPResources.Binaries.SkillSets,
                                             PSPResources.Binaries.SkillSets);
                MonsterSkills      = new AllMonsterSkills(PSPResources.Binaries.MonsterSkills);
                ActionMenus        = new AllActionMenus(PSPResources.Binaries.ActionEvents, Context);
                StatusAttributes   = new AllStatusAttributes(PSPResources.Binaries.StatusAttributes);
                InflictStatuses    = new AllInflictStatuses(PSPResources.Binaries.InflictStatuses);
                PoachProbabilities = new AllPoachProbabilities(PSPResources.Binaries.PoachProbabilities);
                ENTDs            = new AllENTDs(PSPResources.Binaries.ENTD1, PSPResources.Binaries.ENTD2, PSPResources.Binaries.ENTD3, PSPResources.Binaries.ENTD4, PSPResources.Binaries.ENTD5);
                MoveFind         = new AllMoveFindItems(Context, PSPResources.Binaries.MoveFind, new AllMoveFindItems(Context, PSPResources.Binaries.MoveFind));
                StoreInventories = new AllStoreInventories(Context, PSPResources.Binaries.StoreInventories, PSPResources.Binaries.StoreInventories);
                Propositions     = new AllPropositions(PSPResources.Binaries.Propositions, PSPResources.Binaries.Propositions, false);
                break;

            case Context.US_PSX:
                Abilities         = new AllAbilities(PSXResources.Binaries.Abilities, PSXResources.Binaries.AbilityEffects, PSXResources.Binaries.ItemAbilityEffects, PSXResources.Binaries.ReactionAbilityEffects);
                AbilityAnimations = new AllAnimations(Context, PSXResources.Binaries.AbilityAnimations, PSXResources.Binaries.AbilityAnimations);
                Items             = new AllItems(PSXResources.Binaries.OldItems, null);
                ItemAttributes    = new AllItemAttributes(PSXResources.Binaries.OldItemAttributes, null);
                Jobs      = new AllJobs(Context, PSXResources.Binaries.Jobs);
                JobLevels = new JobLevels(Context, PSXResources.Binaries.JobLevels,
                                          new JobLevels(Context, PSXResources.Binaries.JobLevels));
                SkillSets = new AllSkillSets(Context, PSXResources.Binaries.SkillSets,
                                             PSXResources.Binaries.SkillSets);
                MonsterSkills      = new AllMonsterSkills(PSXResources.Binaries.MonsterSkills);
                ActionMenus        = new AllActionMenus(PSXResources.Binaries.ActionEvents, Context);
                StatusAttributes   = new AllStatusAttributes(PSXResources.Binaries.StatusAttributes);
                InflictStatuses    = new AllInflictStatuses(PSXResources.Binaries.InflictStatuses);
                PoachProbabilities = new AllPoachProbabilities(PSXResources.Binaries.PoachProbabilities);
                ENTDs            = new AllENTDs(PSXResources.Binaries.ENTD1, PSXResources.Binaries.ENTD2, PSXResources.Binaries.ENTD3, PSXResources.Binaries.ENTD4);
                MoveFind         = new AllMoveFindItems(Context, PSXResources.Binaries.MoveFind, new AllMoveFindItems(Context, PSXResources.Binaries.MoveFind));
                StoreInventories = new AllStoreInventories(Context, PSXResources.Binaries.StoreInventories, PSXResources.Binaries.StoreInventories);
                Propositions     = new AllPropositions(PSXResources.Binaries.Propositions, PSXResources.Binaries.Propositions, false);
                break;

            default:
                throw new ArgumentException();
            }
        }
Esempio n. 5
0
 public void UpdateView( AllJobs jobs )
 {
     if( FFTPatch.Context != ourContext )
     {
         ourContext = FFTPatch.Context;
         cbJob = null;
     }
     jobsListBox.SelectedIndexChanged -= jobsListBox_SelectedIndexChanged;
     jobsListBox.DataSource = jobs.Jobs;
     jobsListBox.SelectedIndexChanged += jobsListBox_SelectedIndexChanged;
     jobsListBox.SelectedIndex = 0;
     jobEditor.Job = jobsListBox.SelectedItem as Job;
 }
Esempio n. 6
0
        public static void ConvertPsxPatchToPsp(string filename)
        {
            Dictionary <string, byte[]> fileList = new Dictionary <string, byte[]>();

            using (ZipFile zipFile = new ZipFile(filename))
            {
                foreach (ZipEntry entry in zipFile)
                {
                    byte[] bytes = new byte[entry.Size];
                    StreamUtils.ReadFully(zipFile.GetInputStream(entry), bytes);
                    fileList[entry.Name] = bytes;
                }
            }

            File.Delete(filename);

            if (fileList["type"].ToUTF8String() == Context.US_PSX.ToString())
            {
                List <byte> amBytes = new List <byte>(fileList["actionMenus"]);
                amBytes.AddRange(PSPResources.ActionEventsBin.Sub(0xE0, 0xE2));
                fileList["actionMenus"] = amBytes.ToArray();

                AllJobs    aj             = new AllJobs(Context.US_PSX, fileList["jobs"]);
                List <Job> jobs           = new List <Job>(aj.Jobs);
                AllJobs    defaultPspJobs = new AllJobs(Context.US_PSP, PSPResources.JobsBin);
                for (int i = 0; i < jobs.Count; i++)
                {
                    jobs[i].Equipment.Unknown1  = defaultPspJobs.Jobs[i].Equipment.Unknown1;
                    jobs[i].Equipment.Unknown2  = defaultPspJobs.Jobs[i].Equipment.Unknown2;
                    jobs[i].Equipment.Unknown3  = defaultPspJobs.Jobs[i].Equipment.Unknown3;
                    jobs[i].Equipment.FellSword = defaultPspJobs.Jobs[i].Equipment.FellSword;
                    jobs[i].Equipment.LipRouge  = defaultPspJobs.Jobs[i].Equipment.LipRouge;
                    jobs[i].Equipment.Unknown6  = defaultPspJobs.Jobs[i].Equipment.Unknown6;
                    jobs[i].Equipment.Unknown7  = defaultPspJobs.Jobs[i].Equipment.Unknown7;
                    jobs[i].Equipment.Unknown8  = defaultPspJobs.Jobs[i].Equipment.Unknown8;
                }
                for (int i = 160; i < 169; i++)
                {
                    jobs.Add(defaultPspJobs.Jobs[i]);
                }
                ReflectionHelpers.SetFieldOrProperty(aj, "Jobs", jobs.ToArray());
                fileList["jobs"] = aj.ToByteArray(Context.US_PSP);

                JobLevels jl           = new JobLevels(Context.US_PSX, fileList["jobLevels"]);
                JobLevels pspJobLevels = new JobLevels(Context.US_PSP, PSPResources.JobLevelsBin);
                foreach (string jobName in new string[19] {
                    "Archer", "Arithmetician", "Bard", "BlackMage", "Chemist", "Dancer", "Dragoon", "Geomancer",
                    "Knight", "Mime", "Monk", "Mystic", "Ninja", "Orator", "Samurai", "Summoner", "Thief", "TimeMage", "WhiteMage"
                })
                {
                    Requirements psxR = ReflectionHelpers.GetFieldOrProperty <Requirements>(jl, jobName);
                    Requirements pspR = ReflectionHelpers.GetFieldOrProperty <Requirements>(pspJobLevels, jobName);
                    psxR.Unknown1    = pspR.Unknown1;
                    psxR.Unknown2    = pspR.Unknown2;
                    psxR.DarkKnight  = pspR.DarkKnight;
                    psxR.OnionKnight = pspR.OnionKnight;
                }
                ReflectionHelpers.SetFieldOrProperty(jl, "OnionKnight", pspJobLevels.OnionKnight);
                ReflectionHelpers.SetFieldOrProperty(jl, "DarkKnight", pspJobLevels.DarkKnight);
                ReflectionHelpers.SetFieldOrProperty(jl, "Unknown", pspJobLevels.Unknown);
                fileList["jobLevels"] = jl.ToByteArray(Context.US_PSP);

                List <byte> ssBytes = new List <byte>(fileList["skillSets"]);
                ssBytes.AddRange(PSPResources.SkillSetsBin.Sub(ssBytes.Count));
                fileList["skillSets"] = ssBytes.ToArray();

                fileList["entd5"] = PSPResources.ENTD5;



                fileList["type"] = Encoding.UTF8.GetBytes(Context.US_PSP.ToString());

                fileList["pspItemAttributes"] = PSPResources.NewItemAttributesBin;
                fileList["pspItems"]          = PSPResources.NewItemsBin;
            }

            using (FileStream outFile = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite))
                using (ZipOutputStream output = new ZipOutputStream(outFile))
                {
                    foreach (KeyValuePair <string, byte[]> entry in fileList)
                    {
                        WriteFileToZip(output, entry.Key, entry.Value);
                    }
                }
        }
Esempio n. 7
0
 private static void LoadDataFromBytes(
     IList<byte> abilities, IList<byte> abilityEffects,
     IList<byte> oldItems, IList<byte> oldItemAttributes,
     IList<byte> newItems, IList<byte> newItemAttributes,
     IList<byte> jobs, IList<byte> jobLevels,
     IList<byte> skillSets, IList<byte> monsterSkills,
     IList<byte> actionMenus,
     IList<byte> statusAttributes, IList<byte> inflictStatuses,
     IList<byte> poach,
     IList<byte> entd1, IList<byte> entd2, IList<byte> entd3, IList<byte> entd4, IList<byte> entd5,
     IList<byte> moveFind,
     IList<byte> inventories )
 {
     try
     {
         bool psp = Context == Context.US_PSP;
         var Abilities = new AllAbilities( abilities, abilityEffects );
         var Items = new AllItems( oldItems, newItems != null ? newItems : null );
         var ItemAttributes = new AllItemAttributes( oldItemAttributes, newItemAttributes != null ? newItemAttributes : null );
         var Jobs = new AllJobs( Context, jobs );
         var JobLevels = new JobLevels( Context, jobLevels,
             new JobLevels( Context, Context == Context.US_PSP ? PSPResources.JobLevelsBin : PSXResources.JobLevelsBin ) );
         var SkillSets = new AllSkillSets( Context, skillSets,
             Context == Context.US_PSP ? PSPResources.SkillSetsBin : PSXResources.SkillSetsBin );
         var MonsterSkills = new AllMonsterSkills( monsterSkills );
         var ActionMenus = new AllActionMenus( actionMenus, Context );
         var StatusAttributes = new AllStatusAttributes( statusAttributes );
         var InflictStatuses = new AllInflictStatuses( inflictStatuses );
         var PoachProbabilities = new AllPoachProbabilities( poach );
         var ENTDs = psp ? new AllENTDs( entd1, entd2, entd3, entd4, entd5 ) : new AllENTDs( entd1, entd2, entd3, entd4 );
         var MoveFind = new AllMoveFindItems( Context, moveFind, new AllMoveFindItems( Context, psp ? PSPResources.MoveFind : PSXResources.MoveFind ) );
         var StoreInventories = new AllStoreInventories( Context, inventories, psp ? PSPResources.StoreInventoriesBin : PSXResources.StoreInventoriesBin );
         FFTPatch.Abilities = Abilities;
         FFTPatch.Items = Items;
         FFTPatch.ItemAttributes = ItemAttributes;
         FFTPatch.Jobs = Jobs;
         FFTPatch.JobLevels = JobLevels;
         FFTPatch.SkillSets = SkillSets;
         FFTPatch.MonsterSkills = MonsterSkills;
         FFTPatch.ActionMenus = ActionMenus;
         FFTPatch.StatusAttributes = StatusAttributes;
         FFTPatch.InflictStatuses = InflictStatuses;
         FFTPatch.PoachProbabilities = PoachProbabilities;
         FFTPatch.ENTDs = ENTDs;
         FFTPatch.MoveFind = MoveFind;
         FFTPatch.StoreInventories = StoreInventories;
     }
     catch( Exception )
     {
         throw new LoadPatchException();
     }
 }
Esempio n. 8
0
 private static void BuildFromContext()
 {
     switch( Context )
     {
         case Context.US_PSP:
             Abilities = new AllAbilities( PSPResources.AbilitiesBin, PSPResources.AbilityEffectsBin );
             Items = new AllItems(
                 PSPResources.OldItemsBin,
                 PSPResources.NewItemsBin );
             ItemAttributes = new AllItemAttributes(
                 PSPResources.OldItemAttributesBin,
                 PSPResources.NewItemAttributesBin );
             Jobs = new AllJobs( Context, PSPResources.JobsBin );
             JobLevels = new JobLevels( Context, PSPResources.JobLevelsBin,
                 new JobLevels( Context, PSPResources.JobLevelsBin ) );
             SkillSets = new AllSkillSets( Context, PSPResources.SkillSetsBin,
                 PSPResources.SkillSetsBin );
             MonsterSkills = new AllMonsterSkills( PSPResources.MonsterSkillsBin );
             ActionMenus = new AllActionMenus( PSPResources.ActionEventsBin, Context );
             StatusAttributes = new AllStatusAttributes( PSPResources.StatusAttributesBin );
             InflictStatuses = new AllInflictStatuses( PSPResources.InflictStatusesBin );
             PoachProbabilities = new AllPoachProbabilities( PSPResources.PoachProbabilitiesBin );
             ENTDs = new AllENTDs( PSPResources.ENTD1, PSPResources.ENTD2, PSPResources.ENTD3, PSPResources.ENTD4, PSPResources.ENTD5 );
             MoveFind = new AllMoveFindItems( Context, PSPResources.MoveFind, new AllMoveFindItems( Context, PSPResources.MoveFind ) );
             StoreInventories = new AllStoreInventories( Context, PSPResources.StoreInventoriesBin, PSPResources.StoreInventoriesBin );
             break;
         case Context.US_PSX:
             Abilities = new AllAbilities( PSXResources.AbilitiesBin, PSXResources.AbilityEffectsBin );
             Items = new AllItems( PSXResources.OldItemsBin, null );
             ItemAttributes = new AllItemAttributes( PSXResources.OldItemAttributesBin, null );
             Jobs = new AllJobs( Context, PSXResources.JobsBin );
             JobLevels = new JobLevels( Context, PSXResources.JobLevelsBin,
                 new JobLevels( Context, PSXResources.JobLevelsBin ) );
             SkillSets = new AllSkillSets( Context, PSXResources.SkillSetsBin,
                 PSXResources.SkillSetsBin );
             MonsterSkills = new AllMonsterSkills( PSXResources.MonsterSkillsBin );
             ActionMenus = new AllActionMenus( PSXResources.ActionEventsBin, Context );
             StatusAttributes = new AllStatusAttributes( PSXResources.StatusAttributesBin );
             InflictStatuses = new AllInflictStatuses( PSXResources.InflictStatusesBin );
             PoachProbabilities = new AllPoachProbabilities( PSXResources.PoachProbabilitiesBin );
             ENTDs = new AllENTDs( PSXResources.ENTD1, PSXResources.ENTD2, PSXResources.ENTD3, PSXResources.ENTD4 );
             MoveFind = new AllMoveFindItems( Context, PSXResources.MoveFind, new AllMoveFindItems( Context, PSXResources.MoveFind ) );
             StoreInventories = new AllStoreInventories( Context, PSXResources.StoreInventoriesBin, PSXResources.StoreInventoriesBin );
             break;
         default:
             throw new ArgumentException();
     }
 }
Esempio n. 9
0
        public static void ConvertPsxPatchToPsp( string filename )
        {
            Dictionary<string, byte[]> fileList = new Dictionary<string, byte[]>();
            using( ZipFile zipFile = new ZipFile( filename ) )
            {
                foreach( ZipEntry entry in zipFile )
                {
                    byte[] bytes = new byte[entry.Size];
                    StreamUtils.ReadFully( zipFile.GetInputStream( entry ), bytes );
                    fileList[entry.Name] = bytes;
                }
            }

            File.Delete( filename );

            if( fileList["type"].ToUTF8String() == Context.US_PSX.ToString() )
            {
                List<byte> amBytes = new List<byte>( fileList["actionMenus"] );
                amBytes.AddRange( PSPResources.ActionEventsBin.Sub( 0xE0, 0xE2 ) );
                fileList["actionMenus"] = amBytes.ToArray();

                AllJobs aj = new AllJobs( Context.US_PSX, fileList["jobs"] );
                List<Job> jobs = new List<Job>( aj.Jobs );
                AllJobs defaultPspJobs = new AllJobs( Context.US_PSP, PSPResources.JobsBin );
                for( int i = 0; i < jobs.Count; i++ )
                {
                    jobs[i].Equipment.Unknown1 = defaultPspJobs.Jobs[i].Equipment.Unknown1;
                    jobs[i].Equipment.Unknown2 = defaultPspJobs.Jobs[i].Equipment.Unknown2;
                    jobs[i].Equipment.Unknown3 = defaultPspJobs.Jobs[i].Equipment.Unknown3;
                    jobs[i].Equipment.FellSword = defaultPspJobs.Jobs[i].Equipment.FellSword;
                    jobs[i].Equipment.LipRouge = defaultPspJobs.Jobs[i].Equipment.LipRouge;
                    jobs[i].Equipment.Unknown6 = defaultPspJobs.Jobs[i].Equipment.Unknown6;
                    jobs[i].Equipment.Unknown7 = defaultPspJobs.Jobs[i].Equipment.Unknown7;
                    jobs[i].Equipment.Unknown8 = defaultPspJobs.Jobs[i].Equipment.Unknown8;
                }
                for( int i = 160; i < 169; i++ )
                {
                    jobs.Add( defaultPspJobs.Jobs[i] );
                }
                ReflectionHelpers.SetFieldOrProperty( aj, "Jobs", jobs.ToArray() );
                fileList["jobs"] = aj.ToByteArray( Context.US_PSP );

                JobLevels jl = new JobLevels( Context.US_PSX, fileList["jobLevels"] );
                JobLevels pspJobLevels = new JobLevels( Context.US_PSP, PSPResources.JobLevelsBin );
                foreach( string jobName in new string[19] { "Archer", "Arithmetician", "Bard", "BlackMage", "Chemist", "Dancer", "Dragoon", "Geomancer",
                            "Knight", "Mime", "Monk", "Mystic", "Ninja", "Orator", "Samurai", "Summoner", "Thief", "TimeMage", "WhiteMage" } )
                {
                    Requirements psxR = ReflectionHelpers.GetFieldOrProperty<Requirements>( jl, jobName );
                    Requirements pspR = ReflectionHelpers.GetFieldOrProperty<Requirements>( pspJobLevels, jobName );
                    psxR.Unknown1 = pspR.Unknown1;
                    psxR.Unknown2 = pspR.Unknown2;
                    psxR.DarkKnight = pspR.DarkKnight;
                    psxR.OnionKnight = pspR.OnionKnight;
                }
                ReflectionHelpers.SetFieldOrProperty( jl, "OnionKnight", pspJobLevels.OnionKnight );
                ReflectionHelpers.SetFieldOrProperty( jl, "DarkKnight", pspJobLevels.DarkKnight );
                ReflectionHelpers.SetFieldOrProperty( jl, "Unknown", pspJobLevels.Unknown );
                fileList["jobLevels"] = jl.ToByteArray( Context.US_PSP );

                List<byte> ssBytes = new List<byte>( fileList["skillSets"] );
                ssBytes.AddRange( PSPResources.SkillSetsBin.Sub( ssBytes.Count ) );
                fileList["skillSets"] = ssBytes.ToArray();

                fileList["entd5"] = PSPResources.ENTD5;



                fileList["type"] = Encoding.UTF8.GetBytes( Context.US_PSP.ToString() );

                fileList["pspItemAttributes"] = PSPResources.NewItemAttributesBin;
                fileList["pspItems"] = PSPResources.NewItemsBin;
            }

            using( FileStream outFile = new FileStream( filename, FileMode.Create, FileAccess.ReadWrite ) )
            using( ZipOutputStream output = new ZipOutputStream( outFile ) )
            {
                foreach( KeyValuePair<string, byte[]> entry in fileList )
                {
                    WriteFileToZip( output, entry.Key, entry.Value );
                }
            }
        }