Esempio n. 1
0
        public bool PutSettings(Settings o)
        {
            LibmGBA.Layers mask = 0;
            if (o.DisplayBG0)
            {
                mask |= LibmGBA.Layers.BG0;
            }
            if (o.DisplayBG1)
            {
                mask |= LibmGBA.Layers.BG1;
            }
            if (o.DisplayBG2)
            {
                mask |= LibmGBA.Layers.BG2;
            }
            if (o.DisplayBG3)
            {
                mask |= LibmGBA.Layers.BG3;
            }
            if (o.DisplayOBJ)
            {
                mask |= LibmGBA.Layers.OBJ;
            }
            LibmGBA.BizSetLayerMask(_core, mask);

            LibmGBA.Sounds smask = 0;
            if (o.PlayCh0)
            {
                smask |= LibmGBA.Sounds.CH0;
            }
            if (o.PlayCh1)
            {
                smask |= LibmGBA.Sounds.CH1;
            }
            if (o.PlayCh2)
            {
                smask |= LibmGBA.Sounds.CH2;
            }
            if (o.PlayCh3)
            {
                smask |= LibmGBA.Sounds.CH3;
            }
            if (o.PlayChA)
            {
                smask |= LibmGBA.Sounds.CHA;
            }
            if (o.PlayChB)
            {
                smask |= LibmGBA.Sounds.CHB;
            }
            LibmGBA.BizSetSoundMask(_core, smask);

            _settings = o;
            return(false);
        }
        public bool PutSettings(Settings o)
        {
            LibmGBA.Layers mask = 0;
            if (o.DisplayBG0)
            {
                mask |= LibmGBA.Layers.BG0;
            }
            if (o.DisplayBG1)
            {
                mask |= LibmGBA.Layers.BG1;
            }
            if (o.DisplayBG2)
            {
                mask |= LibmGBA.Layers.BG2;
            }
            if (o.DisplayBG3)
            {
                mask |= LibmGBA.Layers.BG3;
            }
            if (o.DisplayOBJ)
            {
                mask |= LibmGBA.Layers.OBJ;
            }
            LibmGBA.BizSetLayerMask(_core, mask);

            LibmGBA.Sounds smask = 0;
            if (o.PlayCh0)
            {
                smask |= LibmGBA.Sounds.CH0;
            }
            if (o.PlayCh1)
            {
                smask |= LibmGBA.Sounds.CH1;
            }
            if (o.PlayCh2)
            {
                smask |= LibmGBA.Sounds.CH2;
            }
            if (o.PlayCh3)
            {
                smask |= LibmGBA.Sounds.CH3;
            }
            if (o.PlayChA)
            {
                smask |= LibmGBA.Sounds.CHA;
            }
            if (o.PlayChB)
            {
                smask |= LibmGBA.Sounds.CHB;
            }
            LibmGBA.BizSetSoundMask(_core, smask);

            var palette = new int[65536];

            GBColors.ColorType c = GBColors.ColorType.vivid;
            switch (o.ColorType)
            {
            case Settings.ColorTypes.Gambatte: c = GBColors.ColorType.gambatte; break;

            case Settings.ColorTypes.Vivid: c = GBColors.ColorType.vivid; break;

            case Settings.ColorTypes.VbaVivid: c = GBColors.ColorType.vbavivid; break;

            case Settings.ColorTypes.VbaGbNew: c = GBColors.ColorType.vbagbnew; break;

            case Settings.ColorTypes.VbaGbOld: c = GBColors.ColorType.vbabgbold; break;

            case Settings.ColorTypes.BizhawkGba: c = GBColors.ColorType.gba; break;
            }
            GBColors.GetLut(c, palette);
            for (var i = 32768; i < 65536; i++)
            {
                palette[i] = palette[i - 32768];
            }
            LibmGBA.BizSetPalette(_core, palette);

            _settings = o;
            return(false);
        }