Esempio n. 1
0
        public void RecalcStages() //Stages need to be modulated closely
        {
            Name = String.Format("Struct{0}", Index);

            MDL0ShaderStructNode prev = null;

            if (Index != 0)
            {
                prev = Parent.Children[Index - 1] as MDL0ShaderStructNode;
            }

            command1 = BPMemory.BPMEM_BP_MASK;

            if (prev != null)
            {
                if (prev.HasOddStage != true)
                {
                    prev.HasOddStage = true;
                }

                command2 = prev.command2 + 1;
                command3 = prev.command3 + 1;

                command4 = (prev.HasOddStage ? prev.command5 : prev.command4) + 2;
                command6 = (prev.HasOddStage ? prev.command7 : prev.command6) + 2;
                command8 = (prev.HasOddStage ? prev.command9 : prev.command8) + 1;

                command5 = HasOddStage ? command4 + 2 : BPMemory.BPMEM_GENMODE;
                command7 = HasOddStage ? command6 + 2 : BPMemory.BPMEM_GENMODE;
                command9 = HasOddStage ? command8 + 1 : BPMemory.BPMEM_GENMODE;
            }
            else //This is structure 0
            {
                command2 = BPMemory.BPMEM_TEV_KSEL0;
                command3 = BPMemory.BPMEM_TREF0;
                command4 = BPMemory.BPMEM_TEV_COLOR_ENV_0;
                command5 = HasOddStage ? BPMemory.BPMEM_TEV_COLOR_ENV_1 : BPMemory.BPMEM_GENMODE;
                command6 = BPMemory.BPMEM_TEV_ALPHA_ENV_0;
                command7 = HasOddStage ? BPMemory.BPMEM_TEV_ALPHA_ENV_1 : BPMemory.BPMEM_GENMODE;
                command8 = BPMemory.BPMEM_IND_CMD0;
                command9 = HasOddStage ? BPMemory.BPMEM_IND_CMD1 : BPMemory.BPMEM_GENMODE;
            }

            if (Index == Parent.Children.Count - 1)
            {
                //This is the last structure
                if (HasOddStage)
                {
                    ((MDL0ShaderNode)Parent).STGs = (byte)(((int)command5 - 0xC0) / 2 + 1);
                }
                else
                {
                    ((MDL0ShaderNode)Parent).STGs = (byte)(((int)command4 - 0xC0) / 2 + 1);
                }
            }

            SignalPropertyChange();
        }
Esempio n. 2
0
        protected override bool OnInitialize()
        {
            StageGroup *header = Header;

            _name = String.Format("Struct{0}", Index);

            command1 = header->mask.Mem;
            command2 = header->ksel.Mem;
            command3 = header->tref.Mem;
            command4 = header->eClrEnv.Mem;
            command5 = header->oClrEnv.Mem;
            command6 = header->eAlpEnv.Mem;
            command7 = header->oAlpEnv.Mem;
            command8 = header->eCMD.Mem;
            command9 = header->oCMD.Mem;

            for (int i = 0xC0; i < 0xDF; i += 2)
            {
                if (Header->oClrEnv.Mem == (BPMemory)i)
                {
                    color2 = true; break;
                }
            }
            for (int i = 0xC1; i < 0xE0; i += 2)
            {
                if (Header->oAlpEnv.Mem == (BPMemory)i)
                {
                    alpha2 = true; break;
                }
            }
            for (int i = 0x10; i < 0x20; i++)
            {
                if (Header->oCMD.Mem == (BPMemory)i)
                {
                    CMD2 = true; break;
                }
            }

            Populate();
            return(true);
        }