예제 #1
0
        public void ReadMoveset(Moveset mset)
        {
            Console.WriteLine("ReadMoveset Method - " + mset.ANBAddress.ToString("x8") + " - " + mset.Name);
            WriteToLog("ReadMoveset Method - " + mset.ANBAddress.ToString("x8") + " - " + mset.Name);
            int startBarOff = 0;

            startBarOff = AddressConverter.To2Offset(mset.ANBAddress + 20);

            MovesetAnimation manim = new MovesetAnimation();

            manim.Address  = startBarOff + 4;
            manim.Value    = PCSX2_RAM.ReadInteger(manim.Address);
            mset.Animation = manim;

            MovesetEffect meffect = new MovesetEffect();

            meffect.Address = startBarOff + 20;
            meffect.Value   = PCSX2_RAM.ReadInteger(meffect.Address);

            meffect.BoneStructure         = new MovesetEffectBoneStructure();
            meffect.BoneStructure.Address = startBarOff + 32;
            meffect.BoneStructure.Value   = PCSX2_RAM.ReadInteger(meffect.BoneStructure.Address);

            //Wth can effects have a 0 value??
            if (meffect.Value != 0)
            {
                //Read Effect Data Modifiers (name according to Xaddgx)
                List <MovesetEffectDataModifierRaw> modifiers = new List <MovesetEffectDataModifierRaw>();
                int    startOfDataModifiers = AddressConverter.To2Offset(meffect.Value);
                string tempDataMod          = string.Empty;
                int    countertemp          = 1;
                while (tempDataMod != "BAR")
                {
                    Console.WriteLine("Reading effect data modifier - " + startOfDataModifiers.ToString("X8"));
                    WriteToLog("Reading effect data modifier - " + startOfDataModifiers.ToString("X8"));
                    MovesetEffectDataModifierRaw mod = new MovesetEffectDataModifierRaw();
                    mod.Address       = startOfDataModifiers;
                    mod.Value         = PCSX2_RAM.ReadInteger(AddressConverter.To2Offset(startOfDataModifiers));
                    mod.DisplayNumber = countertemp;
                    modifiers.Add(mod);

                    startOfDataModifiers += 4;
                    countertemp++;
                    tempDataMod = PCSX2_RAM.ReadString(startOfDataModifiers);
                }

                meffect.DataModifiers = modifiers;
            }

            //Parsing that into Effect Casters (name according to SoraikoSan)
            //if (meffect.Value != 0)
            //{
            //    ECasterList eclist = new ECasterList();
            //    eclist.Children = new List<ECaster>();
            //    var start = AddressConverter.To2Offset(meffect.Value);
            //    eclist.Header = PCSX2_RAM.ReadBytes(start, 4);
            //    eclist.Group1Entries = Convert.ToInt32(eclist.Header[0]);
            //    eclist.Group2Entries = Convert.ToInt32(eclist.Header[1]);
            //    start += 4;

            //    for(int i = 0; i<eclist.Group1Entries; i++)
            //    {
            //        ECaster ec = new ECaster();
            //        ec.StartAddress = start;
            //        ec.Group = ECasterGroup.Group1;
            //        ec.StartAnimationFrame = PCSX2_RAM.ReadShort(start);
            //        ec.EndAnimationFrame = PCSX2_RAM.ReadShort(start + 2);
            //        ec.EffectType = PCSX2_RAM.ReadBytes(start + 4, 1)[0];
            //        Group1Effects eff = (Group1Effects)ec.EffectType;
            //        var addbytes = PCSX2_RAM.ReadBytes(start + 5, 1)[0];
            //        if (addbytes > 0)
            //        {
            //            ec.AdditionalBytes = PCSX2_RAM.ReadBytes(start+6, addbytes*2);
            //        }
            //        ec.Length = 6 + (addbytes * 2);

            //        eclist.Children.Add(ec);

            //        start += ec.Length;
            //    }

            //    for (int j = 0; j<eclist.Group2Entries; j++)
            //    {
            //        ECaster ec = new ECaster();
            //        ec.StartAddress = start;
            //        ec.Group = ECasterGroup.Group2;
            //        ec.StartAnimationFrame = PCSX2_RAM.ReadShort(start);
            //        ec.EffectType = PCSX2_RAM.ReadBytes(start + 2, 1)[0];
            //        Group2Effects ec2 = (Group2Effects)ec.EffectType;
            //        var addbytes = PCSX2_RAM.ReadBytes(start + 3, 1)[0];
            //        if (addbytes > 0)
            //        {
            //            ec.AdditionalBytes = PCSX2_RAM.ReadBytes(start + 4, addbytes * 2);
            //        }

            //        ec.Length = 4 + (addbytes * 2);
            //        eclist.Children.Add(ec);

            //        start += ec.Length;
            //    }
            //    meffect.EffectCasterList = eclist;
            //}
            mset.Effect = meffect;

            _movesets.Add(mset);
        }
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MovesetEffectDataModifierRaw sel = (MovesetEffectDataModifierRaw)comboEffectData.SelectedItem;

            txtValue.Text = sel.Value.ToString("X8");
        }