Exemplo n.º 1
0
        private void Append_Projectile_Button_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            string ReloadJSONFilePath = System.IO.Path.GetDirectoryName(Properties.Settings.Default.ReloadJSONFilePath);

            openFileDialog.InitialDirectory = ReloadJSONFilePath;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.ShowDialog();

            ReloadJSONFilePath = openFileDialog.FileName;

            if (File.Exists(ReloadJSONFilePath))
            {
                StreamReader JSONFS = File.OpenText(ReloadJSONFilePath);
                string       JSON   = JSONFS.ReadToEnd();

                Reload new_reload = JsonConvert.DeserializeObject <Reload>(JSON);

                if (new_reload.game_Ver != Reload.game_ver.FB)
                {
                    throw new Exception("Game version not FB!");
                }

                List <Reload_FB> new_reload_FBs = new_reload.reload_FB;

                for (int i = 0; i < new_reload_FBs.Count; i++)
                {
                    Reload_FB reload_FB     = reload_FBs[i];
                    Reload_FB new_reload_FB = new_reload_FBs[i];

                    int hash_exist = reload_FBs.FindIndex(x => x.hash.Equals(new_reload_FB.hash));

                    if (hash_exist != -1)
                    {
                        reload_FBs[hash_exist] = new_reload_FB;
                    }
                    else
                    {
                        reload_FBs.Add(new_reload_FB);
                    }
                }

                reloadListlv.Items.Refresh();
                JSONFS.Close();
            }
        }
Exemplo n.º 2
0
        private void Edit_File_Button_Click(object sender, RoutedEventArgs e)
        {
            var        item            = ((sender as Button)?.Tag as ListViewItem)?.DataContext;
            var        itemId          = (item as Reload_FB)?.hash;
            int        index           = reload_FBs.FindIndex(s => s.hash == itemId);
            Reload_FB  selectedInfo    = reload_FBs[index];
            Reload_FB  backupInfo      = (Reload_FB)selectedInfo.DeepClone();
            ReloadEdit PACFileInfoEdit = new ReloadEdit(selectedInfo, reload_FBs);
            bool?      save            = PACFileInfoEdit.ShowDialog();

            if (save == false)
            {
                reload_FBs[index] = backupInfo;
            }
            else
            {
                reload_FBs[index] = selectedInfo;
            }

            Projectile_Count = projectile_Properties.individual_Projectile_Properties.Count();

            reloadListlv.Items.Refresh();
        }
Exemplo n.º 3
0
        public void writeReloadBinary_FB(Reload reload)
        {
            if (reload.game_Ver != Reload.game_ver.FB)
            {
                throw new Exception("This reload JSON is not in FB format!");
            }

            if (reload.reload_FB == null)
            {
                throw new Exception("This reload JSON is not in FB format!");
            }

            List <Reload_FB> reload_FBs = reload.reload_FB;

            MemoryStream reloadBin = new MemoryStream();
            MemoryStream hashList  = new MemoryStream();
            MemoryStream info      = new MemoryStream();

            appendUIntMemoryStream(reloadBin, reload.magic_hash, true);
            appendUIntMemoryStream(reloadBin, 0x22, true);
            appendZeroMemoryStream(reloadBin, 8);

            appendUIntMemoryStream(reloadBin, (uint)reload_FBs.Count(), true);
            for (int i = 0; i < reload_FBs.Count(); i++)
            {
                Reload_FB reload_FB = reload_FBs[i];
                appendUIntMemoryStream(hashList, reload_FB.hash, true);

                appendUIntMemoryStream(info, (uint)reload_FB.ammo_type, true);
                appendUIntMemoryStream(info, reload_FB.max_ammo, true);
                appendUIntMemoryStream(info, reload_FB.initial_ammo, true);
                appendUIntMemoryStream(info, reload_FB.timed_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x10, true);
                appendUIntMemoryStream(info, (uint)reload_FB.reload_type, true);
                appendUIntMemoryStream(info, reload_FB.cooldown_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.reload_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.assault_burst_reload_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.blast_burst_reload_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x28, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x2C, true);
                appendUIntMemoryStream(info, reload_FB.inactive_unk_0x30, true);
                appendUIntMemoryStream(info, reload_FB.inactive_cooldown_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.inactive_reload_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.inactive_assault_burst_reload_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.inactive_blast_burst_reload_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.inactive_unk_0x44, true);
                appendUIntMemoryStream(info, reload_FB.inactive_unk_0x48, true);
                appendUIntMemoryStream(info, reload_FB.burst_replenish, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x50, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x54, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x58, true);
                appendUIntMemoryStream(info, (uint)reload_FB.charge_input, true);
                appendUIntMemoryStream(info, reload_FB.charge_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.assault_burst_charge_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.blast_burst_charge_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x6C, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x70, true);
                appendUIntMemoryStream(info, reload_FB.release_charge_duration_frame, true);
                appendUIntMemoryStream(info, reload_FB.max_charge_level, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x7C, true);
                appendUIntMemoryStream(info, reload_FB.unk_0x80, true);
            }

            hashList.Seek(0, SeekOrigin.Begin);
            info.Seek(0, SeekOrigin.Begin);

            hashList.CopyTo(reloadBin);
            info.CopyTo(reloadBin);

            string oPath = Properties.Settings.Default.outputReloadBinFolderPath + @"\" + Path.GetFileNameWithoutExtension(Properties.Settings.Default.ReloadJSONFilePath) + ".bin";

            FileStream ofs = File.Create(oPath);

            reloadBin.Seek(0, SeekOrigin.Begin);
            reloadBin.CopyTo(ofs);

            ofs.Close();
        }
Exemplo n.º 4
0
        public Reload convertMBONtoFBReload(Reload reload)
        {
            if (reload.game_Ver == Reload.game_ver.FB)
            {
                throw new Exception("This reload JSON is already in FB format!");
            }

            List <Reload_FB>   reload_FBs   = new List <Reload_FB>();
            List <Reload_MBON> reload_MBONs = reload.reload_MBON;

            for (int i = 0; i < reload_MBONs.Count(); i++)
            {
                Reload_MBON reload_MBON = reload_MBONs[i];
                Reload_FB   reload_FB   = new Reload_FB();

                reload_FB.hash                 = reload_MBON.hash;
                reload_FB.ammo_type            = reload_MBON.ammo_type;
                reload_FB.max_ammo             = reload_MBON.max_ammo;
                reload_FB.initial_ammo         = reload_MBON.initial_ammo;
                reload_FB.timed_duration_frame = reload_MBON.timed_duration_frame;
                reload_FB.unk_0x10             = reload_MBON.unk_0x10;

                reload_FB.reload_type                         = reload_MBON.reload_type;
                reload_FB.cooldown_duration_frame             = reload_MBON.cooldown_duration_frame;
                reload_FB.reload_duration_frame               = reload_MBON.reload_duration_frame;
                reload_FB.assault_burst_reload_duration_frame = reload_MBON.burst_reload_duration_frame;

                uint ori_burst_reload_duration_frame = reload_MBON.burst_reload_duration_frame;

                // S burst is usually burst duration frame / 3 OR more strictly, burst_replenish_rate_multiplier.
                uint S_burst_reload_duration_frame = (uint)(ori_burst_reload_duration_frame / reload_MBON.s_burst_reload_rate_multiplier);
                // Assign the / 3 value to blast burst reload.
                reload_FB.blast_burst_reload_duration_frame = S_burst_reload_duration_frame;

                reload_FB.unk_0x28 = S_burst_reload_duration_frame;
                reload_FB.unk_0x2C = S_burst_reload_duration_frame;

                reload_FB.inactive_unk_0x30 = reload_MBON.inactive_unk_0x24;

                reload_FB.inactive_cooldown_duration_frame             = reload_MBON.inactive_cooldown_duration_frame;
                reload_FB.inactive_reload_duration_frame               = reload_MBON.inactive_reload_duration_frame;
                reload_FB.inactive_assault_burst_reload_duration_frame = reload_MBON.inactive_burst_reload_duration_frame;
                reload_FB.inactive_blast_burst_reload_duration_frame   = S_burst_reload_duration_frame;
                reload_FB.inactive_unk_0x44 = S_burst_reload_duration_frame;
                reload_FB.inactive_unk_0x48 = S_burst_reload_duration_frame;

                reload_FB.burst_replenish = reload_MBON.burst_replenish;
                reload_FB.unk_0x50        = reload_MBON.unk_0x48;
                reload_FB.unk_0x54        = reload_MBON.unk_0x4C;
                reload_FB.unk_0x58        = reload_MBON.unk_0x50;

                reload_FB.charge_input          = reload_MBON.charge_input;
                reload_FB.charge_duration_frame = reload_MBON.charge_duration_frame;
                reload_FB.assault_burst_charge_duration_frame = reload_MBON.burst_charge_duration_frame;

                uint ori_burst_charge_duration_frame = reload_MBON.burst_charge_duration_frame;

                // S burst is usually burst_charge_duration_frame / 2.
                uint S_burst_charge_duration_frame = (ori_burst_charge_duration_frame / 2);
                // Assign the / 2 value to blast burst reload.
                reload_FB.blast_burst_charge_duration_frame = S_burst_charge_duration_frame;

                reload_FB.unk_0x6C = S_burst_charge_duration_frame;
                reload_FB.unk_0x70 = S_burst_charge_duration_frame;

                reload_FB.release_charge_duration_frame = reload_MBON.release_charge_duration_frame;
                reload_FB.max_charge_level = reload_MBON.max_charge_level;

                reload_FB.unk_0x7C = reload_MBON.unk_0x7C;
                reload_FB.unk_0x80 = reload_MBON.unk_0x80;

                reload_FBs.Add(reload_FB);
            }

            reload.game_Ver    = Reload.game_ver.FB;
            reload.reload_MBON = null;
            reload.reload_FB   = reload_FBs;

            return(reload);
        }
Exemplo n.º 5
0
        public void parse_Reload_FB()
        {
            FileStream fs = File.OpenRead(Properties.Settings.Default.ReloadBinaryFilePath);

            Reload reload = new Reload();

            List <Reload_FB> reload_FBs = new List <Reload_FB>();

            reload.game_Ver = Reload.game_ver.FB;

            uint magic_hash = readUIntBigEndian(fs);
            uint unk_0x4    = readUIntBigEndian(fs); // Always 0x22 for some reason

            fs.Seek(0x8, SeekOrigin.Current);

            reload.magic_hash = magic_hash;
            reload.unit_ID    = 0;

            uint total_ammo_count = readUIntBigEndian(fs); // Always 3 more than normal ammo, with the last 3 constantly the same.

            uint info_pos = (uint)fs.Position + (total_ammo_count * 0x4);

            for (int i = 0; i < total_ammo_count; i++)
            {
                Reload_FB reload_FB = new Reload_FB();

                reload_FB.hash = readUIntBigEndian(fs);

                uint return_pos = (uint)fs.Position;
                fs.Seek(info_pos + (i * 0x84), SeekOrigin.Begin);

                uint ammo_type  = readUIntBigEndian(fs);
                bool isAmmoType = Enum.IsDefined(typeof(ammo_type_enum), (int)ammo_type);

                //if (!isAmmoType && i > 50)
                //throw new Exception("Unidentified Ammo Type!");

                reload_FB.ammo_type            = (ammo_type_enum)ammo_type;
                reload_FB.max_ammo             = readUIntBigEndian(fs);
                reload_FB.initial_ammo         = readUIntBigEndian(fs);
                reload_FB.timed_duration_frame = readUIntBigEndian(fs);
                reload_FB.unk_0x10             = readUIntBigEndian(fs);

                uint reload_type  = readUIntBigEndian(fs);
                bool isReloadType = Enum.IsDefined(typeof(reload_type_enum), (int)reload_type);

                //if (!isReloadType && i > 50)
                //throw new Exception("Unidentified Reload Type!");

                reload_FB.reload_type                         = (reload_type_enum)reload_type;
                reload_FB.cooldown_duration_frame             = readUIntBigEndian(fs);
                reload_FB.reload_duration_frame               = readUIntBigEndian(fs);
                reload_FB.assault_burst_reload_duration_frame = readUIntBigEndian(fs);
                reload_FB.blast_burst_reload_duration_frame   = readUIntBigEndian(fs);

                uint unk_0x28 = readUIntBigEndian(fs);
                //if (unk_0x28 != reload_FB.assault_burst_reload_duration_frame)
                //throw new Exception("unk_0x28 not the same as blast burst frame duration!");
                reload_FB.unk_0x28 = unk_0x28;

                uint unk_0x2C = readUIntBigEndian(fs);
                //if (unk_0x2C != reload_FB.blast_burst_reload_duration_frame)
                //throw new Exception("unk_0x2C not the same as blast burst frame duration!");
                reload_FB.unk_0x2C = unk_0x2C;

                uint unk_0x30 = readUIntBigEndian(fs);
                //if (unk_0x30 != 0 && i > 50)
                //throw new Exception("unk_0x30 not 0!");
                reload_FB.inactive_unk_0x30 = unk_0x30;

                uint inactive_cooldown_duration_frame = readUIntBigEndian(fs);
                //if (cooldown_duration_frame_copy != reload_FB.cooldown_duration_frame)
                //throw new Exception("cooldown_duration_frame_copy not same!");
                reload_FB.inactive_cooldown_duration_frame = inactive_cooldown_duration_frame;

                uint inactive_reload_duration_frame = readUIntBigEndian(fs);
                //if (reload_duration_frame_copy != reload_FB.reload_duration_frame && i > 50)
                //throw new Exception("reload_duration_frame_copy not same!");
                reload_FB.inactive_reload_duration_frame = inactive_reload_duration_frame;

                uint inactive_assault_burst_reload_duration_frame = readUIntBigEndian(fs);
                //if (assault_burst_reload_duration_frame_copy != reload_FB.assault_burst_reload_duration_frame)
                //throw new Exception("assault_burst_reload_duration_frame_copy not same!");
                reload_FB.inactive_assault_burst_reload_duration_frame = inactive_assault_burst_reload_duration_frame;

                uint inactive_blast_burst_reload_duration_fram = readUIntBigEndian(fs);
                //if (blast_burst_reload_duration_frame_copy != reload_FB.blast_burst_reload_duration_frame)
                //throw new Exception("blast_burst_reload_duration_frame_copy not same!");
                reload_FB.inactive_blast_burst_reload_duration_frame = inactive_blast_burst_reload_duration_fram;

                uint inactive_unk_0x44 = readUIntBigEndian(fs);
                //if (unk_0x44 != reload_FB.unk_0x28)
                //throw new Exception("unk_0x44 not same!");
                reload_FB.inactive_unk_0x44 = inactive_unk_0x44;

                uint inactive_unk_0x48 = readUIntBigEndian(fs);
                //if (unk_0x48 != reload_FB.unk_0x2C)
                //throw new Exception("unk_0x48 not same!");
                reload_FB.inactive_unk_0x48 = inactive_unk_0x48;

                reload_FB.burst_replenish = readUIntBigEndian(fs);
                reload_FB.unk_0x50        = readUIntBigEndian(fs);
                reload_FB.unk_0x54        = readUIntBigEndian(fs);
                reload_FB.unk_0x58        = readUIntBigEndian(fs);

                uint charge_input = readUIntBigEndian(fs);

                //if (charge_input > 0x4)
                //throw new Exception("Unidentified Charge Type!");

                reload_FB.charge_input          = (charge_input_enum)charge_input;
                reload_FB.charge_duration_frame = readUIntBigEndian(fs);
                reload_FB.assault_burst_charge_duration_frame = readUIntBigEndian(fs);
                reload_FB.blast_burst_charge_duration_frame   = readUIntBigEndian(fs);

                uint unk_0x6C = readUIntBigEndian(fs);
                //if (unk_0x6C != reload_FB.blast_burst_charge_duration_frame)
                //throw new Exception("unk_0x6C not same!");
                reload_FB.unk_0x6C = unk_0x6C;

                uint unk_0x70 = readUIntBigEndian(fs);
                //if (unk_0x70 != reload_FB.blast_burst_charge_duration_frame)
                //throw new Exception("unk_0x70 not same!");
                reload_FB.unk_0x70 = unk_0x70;

                reload_FB.release_charge_duration_frame = readUIntBigEndian(fs);
                reload_FB.max_charge_level = readUIntBigEndian(fs);
                reload_FB.unk_0x7C         = readUIntBigEndian(fs);
                reload_FB.unk_0x80         = readUIntBigEndian(fs);

                reload_FBs.Add(reload_FB);

                fs.Seek(return_pos, SeekOrigin.Begin);
            }

            reload.reload_FB = reload_FBs;

            // Save JSON
            string JSON = JsonConvert.SerializeObject(reload, Formatting.Indented);

            string fileName   = Path.GetFileNameWithoutExtension(Properties.Settings.Default.ReloadBinaryFilePath);
            string outputPath = Properties.Settings.Default.outputReloadJSONFolderPath + @"\" + fileName + @"_Reload.JSON";

            StreamWriter fsJSON = File.CreateText(outputPath);

            fsJSON.Write(JSON);
            fsJSON.Close();
        }
Exemplo n.º 6
0
 public ReloadEdit(Reload_FB Reload_FB, List <Reload_FB> reload_FBs)
 {
     InitializeComponent();
 }