Пример #1
0
 private void radioButton2_useExternal_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButton2_useExternal.Checked)
     {
         if (Paletter.LoadPalette(textBox1.Text) != null)
         {
             ShowPalette(Paletter.LoadPalette(textBox1.Text));
         }
     }
 }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();

            op.Title  = "Open palette file";
            op.Filter = "Palette file (*.pal)|*.pal;*.PAL";
            if (op.ShowDialog(this) == DialogResult.OK)
            {
                if (Paletter.LoadPalette(op.FileName) != null)
                {
                    textBox1.Text = op.FileName;
                    ShowPalette(Paletter.LoadPalette(op.FileName));
                }
                else
                {
                    MessageBox.Show("Can't load this palette file !!");
                }
            }
        }
Пример #3
0
        public void SetTvFormat(TvFormat format, PaletteFormat plFormat)
        {
            switch (format)
            {
            case TvFormat.Ntsc:
                ScanlinesPerFrame = 261;
                _framePeriod      = 0.01667; //60 FPS
                //FramePeriod = 2;
                ScanlineOfVblank = 244;
                if (plFormat.UseInternalPalette)
                {
                    switch (plFormat.UseInternalPaletteMode)
                    {
                    case UseInternalPaletteMode.Auto:
                        Palette = Paletter.NtscPalette;
                        break;

                    case UseInternalPaletteMode.Ntsc:
                        Palette = Paletter.NtscPalette;
                        break;

                    case UseInternalPaletteMode.Pal:
                        Palette = Paletter.PalPalette;
                        break;
                    }
                }
                else
                {
                    if (Paletter.LoadPalette(plFormat.ExternalPalettePath) != null)
                    {
                        Palette = Paletter.LoadPalette(plFormat.ExternalPalettePath);
                    }
                    else
                    {
                        Palette = Paletter.NtscPalette;
                        Debug.WriteLine(this,
                                        "Could not find the external palette file, uses the defualt palette for NTSC.",
                                        DebugStatus.Error);
                    }
                }
                break;

            case TvFormat.Pal:
                ScanlinesPerFrame = 311;
                _framePeriod      = 0.020; //50 FPS
                ScanlineOfVblank  = 290;
                if (plFormat.UseInternalPalette)
                {
                    switch (plFormat.UseInternalPaletteMode)
                    {
                    case UseInternalPaletteMode.Auto:
                        Palette = Paletter.PalPalette;
                        break;

                    case UseInternalPaletteMode.Ntsc:
                        Palette = Paletter.NtscPalette;
                        break;

                    case UseInternalPaletteMode.Pal:
                        Palette = Paletter.PalPalette;
                        break;
                    }
                }
                else
                {
                    if (Paletter.LoadPalette(plFormat.ExternalPalettePath) != null)
                    {
                        Palette = Paletter.LoadPalette(plFormat.ExternalPalettePath);
                    }
                    else
                    {
                        Palette = Paletter.PalPalette;
                        Debug.WriteLine(this,
                                        "Could not find the external palette file, uses the defualt palette for PAL.",
                                        DebugStatus.Error);
                    }
                }
                break;
            }
        }