예제 #1
0
        public void SaveSettings(FileParser.Block block)
        {
            block.SetBool("Use Custom Address", useCustomAddress);
            if (useCustomAddress)
            {
                block.SetInt("Custom Address", segmentOffset);
            }
            block.SetIntArray("ROM Pointers", pointerControl.GetROMPointers());
            block.SetIntArray("RAM Pointers", pointerControl.GetRAMPointers());
            block.SetInt("Layer", (int)numLayer.Value);

            for (int i = 0; i < paramControls.Length; i++)
            {
                block.SetInt(paramControls[i].ParameterName, (int)paramControls[i].cmbType.SelectedIndex);
                if (paramControls[i].cmbType.SelectedIndex == paramControls[i].cmbType.Items.Count - 1)
                {
                    block.SetInt("Custom " + paramControls[i].ParameterName, paramControls[i].customValue);
                }
            }

            block.SetString("Obj File", sourceFileName);
            block.SetInt("Color Interpretation", (int)conversionSettings.colorInterpretation);
            if (displayList != null)
            {
                block.SetInt("Cycle Type", (int)displayList.renderstates.cycleType, false);
                block.SetInt("Blend modes", displayList.renderstates.blendMode);
                block.SetInt("Render states", displayList.renderstates.otherModesLow);
                block.SetInt("RCP Set", displayList.renderstates.RCPSet);
                block.SetInt("RCP Unset", displayList.renderstates.RCPUnset);
                block.SetInt("Combiner Low", (int)(displayList.renderstates.combiner.state & 0xFFFFFFFF));
                block.SetInt("Combiner High", (int)((displayList.renderstates.combiner.state >> 0x20) & 0xFFFFFF));
                block.SetDouble("Texture Scale X", displayList.renderstates.textureScaleX);
                block.SetDouble("Texture Scale Y", displayList.renderstates.textureScaleY);
            }
            if (this.textureControl.materialLibrary != null)
            {
                foreach (KeyValuePair <string, TextureInfo> tex in this.textureControl.materialLibrary)
                {
                    if (tex.Value.addressX != TextureInfo.AddressMode.G_TX_WRAP || tex.Value.addressY != TextureInfo.AddressMode.G_TX_WRAP || tex.Value.stRAMPointers.Length + tex.Value.stROMPointers.Length > 0)
                    {
                        block.SetBlock(tex.Key, new FileParser.Block(tex.Value));
                    }
                }
            }
        }