示例#1
0
        private void SetupColorizer()
        {
            // only setup if enabled and path is set
            if (!_config.Global.Colorize || _altcolorPath == null || _gameName == null)
            {
                return;
            }

            // abort if already setup
            if (_gray2Colorizer != null || _gray4Colorizer != null)
            {
                return;
            }
            var palPath1 = Path.Combine(_altcolorPath, _gameName, _gameName + ".pal");
            var palPath2 = Path.Combine(_altcolorPath, _gameName, "pin2dmd.pal");
            var vniPath1 = Path.Combine(_altcolorPath, _gameName, _gameName + ".vni");
            var vniPath2 = Path.Combine(_altcolorPath, _gameName, "pin2dmd.vni");

            var palPath = File.Exists(palPath1) ? palPath1 : palPath2;
            var vniPath = File.Exists(vniPath1) ? vniPath1 : vniPath2;

            if (File.Exists(palPath))
            {
                try {
                    Logger.Info("Loading palette file at {0}...", palPath);
                    _coloring = new Coloring(palPath);
                    VniAnimationSet vni = null;
                    if (File.Exists(vniPath))
                    {
                        Logger.Info("Loading virtual animation file at {0}...", vniPath);
                        vni = new VniAnimationSet(vniPath);
                        Logger.Info("Loaded animation set {0}", vni);
                    }
                    _gray2Colorizer = new Gray2Colorizer(_coloring, vni);
                    _gray4Colorizer = new Gray4Colorizer(_coloring, vni);
                } catch (Exception e) {
                    Logger.Warn(e, "Error initializing colorizer: {0}", e.Message);
                }
            }
            else
            {
                Logger.Info("No palette file found at {0}.", palPath);
            }
        }
示例#2
0
        private void SetupColorizer()
        {
            // only setup if enabled and path is set
            if (!_config.Global.Colorize || _altcolorPath == null || _gameName == null || !_colorize)
            {
                return;
            }

            // abort if already setup
            if (_gray2Colorizer != null || _gray4Colorizer != null)
            {
                return;
            }
            var palPath1 = Path.Combine(_altcolorPath, _gameName, _gameName + ".pal");
            var palPath2 = Path.Combine(_altcolorPath, _gameName, "pin2dmd.pal");
            var vniPath1 = Path.Combine(_altcolorPath, _gameName, _gameName + ".vni");
            var vniPath2 = Path.Combine(_altcolorPath, _gameName, "pin2dmd.vni");

            var palPath = File.Exists(palPath1) ? palPath1 : palPath2;
            var vniPath = File.Exists(vniPath1) ? vniPath1 : vniPath2;

            if (File.Exists(palPath))
            {
                try {
                    Logger.Info("Loading palette file at {0}...", palPath);
                    _coloring = new Coloring(palPath);
                    VniAnimationSet vni = null;
                    if (File.Exists(vniPath))
                    {
                        Logger.Info("Loading virtual animation file at {0}...", vniPath);
                        vni = new VniAnimationSet(vniPath);
                        Logger.Info("Loaded animation set {0}", vni);
                        aniHeight = vni.MaxHeight;
                        aniWidth  = vni.MaxWidth;
                        Logger.Info("Animation Dimensions: {0}x{1}", aniWidth, aniHeight);
                    }
                    else
                    {
                        Logger.Info("No animation set found");
                        aniHeight = Height;
                        aniWidth  = Width;
                    }

                    _gray2Colorizer = new Gray2Colorizer(_coloring, vni);
                    _gray4Colorizer = new Gray4Colorizer(_coloring, vni);

                    _gray2Colorizer.ScalerMode = _config.Global.ScalerMode;
                    _gray4Colorizer.ScalerMode = _config.Global.ScalerMode;
                } catch (Exception e) {
                    Logger.Warn(e, "Error initializing colorizer: {0}", e.Message);
                }
            }
            else
            {
                Logger.Info("No palette file found at {0}.", palPath);
            }

            if (_config.Global.ScaleToHd)
            {
                Logger.Info("ScaleToHd = True, ScalerMode = " + _config.Global.ScalerMode.ToString());
            }
            else
            {
                Logger.Info("ScaleToHd = False");
            }
        }
示例#3
0
        /// <summary>
        /// Wird uisgfiärt wemmr aui Parametr hend.
        /// </summary>
        /// <remarks>
        /// Es cha si dass das meh as einisch uisgfiärt wird, wobih's DMD numä
        /// einisch ersteuht wird.
        /// </remarks>
        public void Init()
        {
            if (_isOpen)
            {
                return;
            }

            _gray2Colorizer = null;
            _gray4Colorizer = null;
            _coloring       = null;

            if (_config.Global.Colorize && _altcolorPath != null)
            {
                var palPath1 = Path.Combine(_altcolorPath, _gameName, _gameName + ".pal");
                var palPath2 = Path.Combine(_altcolorPath, _gameName, "pin2dmd.pal");
                var vniPath1 = Path.Combine(_altcolorPath, _gameName, _gameName + ".vni");
                var vniPath2 = Path.Combine(_altcolorPath, _gameName, "pin2dmd.vni");

                var palPath = File.Exists(palPath1) ? palPath1 : palPath2;
                var vniPath = File.Exists(vniPath1) ? vniPath1 : vniPath2;

                if (File.Exists(palPath))
                {
                    try {
                        Logger.Info("Loading palette file at {0}...", palPath);
                        _coloring = new Coloring(palPath);
                        VniAnimationSet vni = null;
                        if (File.Exists(vniPath))
                        {
                            Logger.Info("Loading virtual animation file at {0}...", vniPath);
                            vni = new VniAnimationSet(vniPath);
                            Logger.Info("Loaded animation set {0}", vni);
                        }
                        _gray2Colorizer = new Gray2Colorizer(_coloring, vni);
                        _gray4Colorizer = new Gray4Colorizer(_coloring, vni);
                    } catch (Exception e) {
                        Logger.Warn(e, "Error initializing colorizer: {0}", e.Message);
                    }
                }
                else
                {
                    Logger.Info("No palette file found at {0}.", palPath);
                }
            }
            else
            {
                Logger.Info("Bit-convertion disabled.");
            }

            if (_config.VirtualDmd.Enabled)
            {
                if (_dmd == null)
                {
                    Logger.Info("Opening virtual DMD...");
                    CreateVirtualDmd();
                }
                else
                {
                    _dmd.Dispatcher.Invoke(() => {
                        SetupGraphs();
                        SetupVirtualDmd();
                    });
                }
            }
            else
            {
                SetupGraphs();
            }
            _isOpen = true;
        }