コード例 #1
0
ファイル: PaletteConfig.cs プロジェクト: nickmass/Emu-o-Tron
 public PaletteConfig(EmuConfig config, uint[] palette)
 {
     this.config = config;
     this.palette = palette;
     InitializeComponent();
     trkGamma.Value = (int)(double.Parse(config["gamma"]) * 10);
     trkSat.Value = (int)(double.Parse(config["saturation"]) * 10);
     trkHue.Value = (int)(double.Parse(config["hue"]) * 10);
     trkBrightness.Value = (int)(double.Parse(config["brightness"]) * 10);
     NTSCFilter.gamma = (trkGamma.Value / 10.0);
     NTSCFilter.sat = (trkSat.Value / 10.0);
     NTSCFilter.hue = (trkHue.Value / 10.0);
     NTSCFilter.brightness = (trkBrightness.Value / 10.0);
     txtPath.Text = config["palette"];
     openPalette.InitialDirectory = config["paletteDir"];
     panelGFX = panel1.CreateGraphics();
     buffer = new Bitmap(256, 256, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     if (config["simulatedPalette"] == "1")
     {
         radInternal.Checked = true;
         radExternal.Checked = false;
     }
     else
     {
         radInternal.Checked = false;
         radExternal.Checked = true;
         LoadExternal();
         UpdateSwatches();
     }
     btnDefaults.Enabled = tmrPalUpdate.Enabled = trkHue.Enabled = trkSat.Enabled = trkBrightness.Enabled = trkGamma.Enabled = radInternal.Checked;
     change = true;
     txtPath.Enabled = btnBrowse.Enabled = radExternal.Checked;
 }
コード例 #2
0
ファイル: PaletteConfig.cs プロジェクト: DualBrain/Emu-o-Tron
 public PaletteConfig(EmuConfig config, uint[] palette)
 {
     this.config  = config;
     this.palette = palette;
     InitializeComponent();
     trkGamma.Value               = (int)(double.Parse(config["gamma"]) * 10);
     trkSat.Value                 = (int)(double.Parse(config["saturation"]) * 10);
     trkHue.Value                 = (int)(double.Parse(config["hue"]) * 10);
     trkBrightness.Value          = (int)(double.Parse(config["brightness"]) * 10);
     NTSCFilter.gamma             = (trkGamma.Value / 10.0);
     NTSCFilter.sat               = (trkSat.Value / 10.0);
     NTSCFilter.hue               = (trkHue.Value / 10.0);
     NTSCFilter.brightness        = (trkBrightness.Value / 10.0);
     txtPath.Text                 = config["palette"];
     openPalette.InitialDirectory = config["paletteDir"];
     panelGFX = panel1.CreateGraphics();
     buffer   = new Bitmap(256, 256, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     if (config["simulatedPalette"] == "1")
     {
         radInternal.Checked = true;
         radExternal.Checked = false;
     }
     else
     {
         radInternal.Checked = false;
         radExternal.Checked = true;
         LoadExternal();
         UpdateSwatches();
     }
     btnDefaults.Enabled = tmrPalUpdate.Enabled = trkHue.Enabled = trkSat.Enabled = trkBrightness.Enabled = trkGamma.Enabled = radInternal.Checked;
     change          = true;
     txtPath.Enabled = btnBrowse.Enabled = radExternal.Checked;
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: nickmass/Emu-o-Tron
        public void Initialize()
        {
            this.appPath = Path.GetDirectoryName(Application.ExecutablePath);
            Directory.SetCurrentDirectory(appPath);
            config = new EmuConfig("Emu-o-Tron.cfg");
            this.LoadKeys();
            if (!File.Exists(this.config["palette"]))
                this.config["palette"] = config.defaults["palette"];
            FileStream palFile = File.OpenRead(this.config["palette"]);
            for (int i = 0; i < 0x40; i++)
                this.colorChart[i] = (uint)((0xFF << 24) | (palFile.ReadByte() << 16) | (palFile.ReadByte() << 8) | palFile.ReadByte());
            if (palFile.Length > 0x40 * 3) //shitty hack for vs palette because im LAZY
            {
                uint[] vsColor = new uint[0x200];
                for (int i = 0; palFile.Position < palFile.Length; i++)
                {
                    vsColor[i] = colorChart[palFile.ReadByte()];
                }
                colorChart = vsColor;
            }
            palFile.Close();
            CreateEmphasisTables();
            if (this.config["showFPS"] == "1")
            {
                this.showFPSToolStripMenuItem.Checked = true;
                this.showFPS = true;
            }
            else
            {
                this.showFPSToolStripMenuItem.Checked = false;
                this.showFPS = false;
            }
            if (this.config["showInput"] == "1")
            {
                this.showInputToolStripMenuItem.Checked = true;
                this.showInput = true;
            }
            else
            {
                this.showInputToolStripMenuItem.Checked = false;
                this.showInput = false;
            }
            this.smoothOutputToolStripMenuItem.Checked = (this.config["smoothOutput"] == "1");
            this.spritesToolStripMenuItem.Checked = (config["displaySprites"] == "1");
            this.backgroundToolStripMenuItem.Checked = (config["displayBG"] == "1");
            this.spriteLimitToolStripMenuItem.Checked = (config["disableSpriteLimit"] == "1");
            this.openPaletteDialog.InitialDirectory = Path.GetFullPath(this.config["paletteDir"]);
            this.openMovieDialog.InitialDirectory = Path.GetFullPath(this.config["movieDir"]);
            this.saveMovie.InitialDirectory = Path.GetFullPath(this.config["movieDir"]);
            this.openFile.InitialDirectory = Path.GetFullPath(this.config["romPath1"]);
            this.enableSoundToolStripMenuItem.Checked = (config["sound"] == "1");
            this.nTSCToolStripMenuItem.Checked = (SystemType)Convert.ToInt32(config["region"]) == SystemType.NTSC;
            this.pALToolStripMenuItem.Checked = (SystemType)Convert.ToInt32(config["region"]) == SystemType.PAL;
            for(int i = 1; i <= 5; i++)
                if(this.config["romPath" + i.ToString()] != "")
                    this.openFile.CustomPlaces.Add(this.config["romPath" + i.ToString()]);
            this.LoadRecentFiles();
            this.Width = Convert.ToInt32(this.config["width"]);
            this.Height = Convert.ToInt32(this.config["height"]);
            config["rawNESPalette"] = "0";
            switch (this.config["scaler"].ToLower())
            {
                default:
                case "sizable":
                case "sizeable":
                    sizeableToolStripMenuItem.Checked = true;
                    this.imageScaler = new Sizeable();
                    break;
                case "1x":
                    xToolStripMenuItem.Checked = true;
                    this.imageScaler = new NearestNeighbor1x();
                    break;
                case "2x":
                    xToolStripMenuItem1.Checked = true;
                    this.imageScaler = new NearestNeighbor2x();
                    break;
                case "scale2x":
                    scale2xToolStripMenuItem.Checked = true;
                    this.imageScaler = new Scale2x();
                    break;
                case "scale3x":
                    scale3xToolStripMenuItem.Checked = true;
                    this.imageScaler = new Scale3x();
                    break;
                case "fill":
                    fillToolStripMenuItem.Checked = true;
                    this.imageScaler = new Fill();
                    break;
                case "tv":
                    tVAspectToolStripMenuItem.Checked = true;
                    this.imageScaler = new TVAspect();
                    break;
                case "hq2x":
                    hQ2xToolStripMenuItem.Checked = true;
                    this.imageScaler = new HQ2x();
                    break;
                case "phosphor2x":
                    this.imageScaler = new Phosphor2x();
                    break;
                case "phosphor3x":
                    this.imageScaler = new Phosphor3x();
                    break;
                case "ntsc":
                    this.imageScaler = new NTSC();
                    config["rawNESPalette"] = "1";
                    break;
            }

            PrepareScaler();
            rewindingEnabled = this.config["rewindEnabled"] == "1" ? true : false;
            saveBufferFreq = Convert.ToInt32(this.config["rewindBufferFreq"]);
            saveBufferSeconds = Convert.ToInt32(this.config["rewindBufferSeconds"]);
            saveBuffer = new SaveState[(60 / saveBufferFreq) * saveBufferSeconds];

            player1A.freq = 2;
            player1A.count = 1;
            player1B.freq = 2;
            player1B.count = 1;
            player2A.freq = 2;
            player2A.count = 1;
            player2B.freq = 2;
            player2B.count = 1;
            state = SystemState.Empty;
            surfaceControl.Visible = false;

            volume.master = Convert.ToInt32(config["volume"]) / 100f;
            volume.square1 = 1;
            volume.square2 = 1;
            volume.triangle = 1;
            volume.noise = 1;
            volume.dmc = 1;
            volume.external = 1;
            if (this.romPath != "")
                this.OpenFile(romPath);
        }