コード例 #1
0
        public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution)
        {
            string path = AppConfig.GetFullPath("yuzu");

            string exe = Path.Combine(path, "yuzu.exe");

            if (!File.Exists(exe))
            {
                return(null);
            }

            string conf = Path.Combine(path, "user", "config", "qt-config.ini");

            if (File.Exists(conf))
            {
                var ini = new IniFile(conf);
                ini.WriteValue("UI", "fullscreen\\default", "false");
                ini.WriteValue("UI", "fullscreen", "true");
                ini.Save();
            }

            return(new ProcessStartInfo()
            {
                FileName = exe,
                WorkingDirectory = path,
                Arguments = "-f -g \"" + rom + "\"",
            });
        }
コード例 #2
0
        private void CreateControllerConfiguration(string path)
        {
            return;

            if (Program.SystemConfig.isOptSet("disableautocontrollers") && Program.SystemConfig["disableautocontrollers"] == "1")
            {
                return;
            }

            string controllerProfiles = Path.Combine(path, "controllerProfiles");

            foreach (var controller in this.Controllers)
            {
                if (controller.Input == null)
                {
                    continue;
                }

                string controllerTxt = Path.Combine(controllerProfiles, "controller" + (controller.Index - 1) + ".txt");
                using (IniFile ini = new IniFile(controllerTxt, true))
                {
                    ConfigureInput(ini, controller.Input);
                    ini.Save();
                }
            }
        }
コード例 #3
0
        public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution)
        {
            string path = AppConfig.GetFullPath("gsplus-win-sdl");

            if (string.IsNullOrEmpty(path))
            {
                path = AppConfig.GetFullPath("gsplus");
            }

            string exe = Path.Combine(path, "gsplus.exe");

            if (!File.Exists(exe))
            {
                return(null);
            }

            IniFile conf = new IniFile(Path.Combine(path, "config.txt"), true);

            conf.WriteValue(null, "s5d1", "");
            conf.WriteValue(null, "s5d2", "");
            conf.WriteValue(null, "s6d1", "");
            conf.WriteValue(null, "s6d2", "");
            conf.WriteValue(null, "s7d1", "");

            if (!string.IsNullOrEmpty(AppConfig["bios"]) && Directory.Exists(AppConfig["bios"]))
            {
                conf.WriteValue(null, "g_cfg_rom_path", Path.Combine(AppConfig.GetFullPath("bios"), "APPLE2GS.ROM"));
            }

            if (Path.GetExtension(rom).ToLowerInvariant() == ".2mg")
            {
                conf.WriteValue(null, "s7d1", rom);
            }

            conf.Save();

            _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution);
            _resolution    = resolution;

            string screenShots = "";

            if (!string.IsNullOrEmpty(AppConfig["thumbnails"]) && Directory.Exists(AppConfig["thumbnails"]))
            {
                screenShots = " -ssdir \"" + AppConfig.GetFullPath("thumbnails") + "\"";
            }

            return(new ProcessStartInfo()
            {
                FileName = exe,
                WorkingDirectory = path,
                Arguments = "-borderless -sw 1920 -sh 1080" + screenShots,
            });
        }
コード例 #4
0
        /*
         * private static void removeControllerConfig_gamecube()
         * {
         *  string path = Program.AppConfig.GetFullPath("dolphin");
         *
         *  string iniFile = Path.Combine(path, "User", "Config", "GCPadNew.ini");
         *  if (!File.Exists(iniFile))
         *      return;
         *
         *  File.Delete(iniFile);
         * }*/

        private static void generateControllerConfig_realwiimotes(string path, string filename, string anyDefKey)
        {
            string iniFile = Path.Combine(path, "User", "Config", filename);

            using (IniFile ini = new IniFile(iniFile, true))
            {
                for (int i = 0; i < 5; i++)
                {
                    ini.ClearSection("[" + anyDefKey + i.ToString() + "]");
                    ini.WriteValue("[" + anyDefKey + i.ToString() + "]", "Source", "2");
                }

                ini.Save();
            }
        }
コード例 #5
0
        private static void generateControllerConfig_any(string path, string filename, string anyDefKey, InputKeyMapping anyMapping, Dictionary <string, string> anyReverseAxes, Dictionary <string, string> anyReplacements, Dictionary <string, string> extraOptions = null)
        {
            //string path = Program.AppConfig.GetFullPath("dolphin");
            string iniFile = Path.Combine(path, "User", "Config", filename);

            int nsamepad = 0;

            Dictionary <string, int> double_pads = new Dictionary <string, int>();

            using (IniFile ini = new IniFile(iniFile, true))
            {
                foreach (var pad in Program.Controllers)
                {
                    string gcpad = anyDefKey + pad.PlayerIndex;
                    ini.ClearSection(gcpad);

                    if (pad.Config == null)
                    {
                        continue;
                    }

                    // SIDevice0 = 7 -> Keyb GCKeyNew.ini
                    // SIDevice1 = 6 -> controlleur standard GCPadNew.ini

                    string tech       = "XInput";
                    string deviceName = "Gamepad";

                    if (pad.Config.Type == "keyboard")
                    {
                        tech       = "DInput";
                        deviceName = "Keyboard Mouse";
                    }
                    else if (!pad.Config.IsXInputDevice())
                    {
                        var di = pad.Config.GetDirectInputInfo();
                        if (di == null)
                        {
                            continue;
                        }

                        tech       = "DInput";
                        deviceName = di.Name;
                    }

                    if (double_pads.ContainsKey(tech + "/" + deviceName))
                    {
                        nsamepad = double_pads[tech + "/" + deviceName];
                    }
                    else
                    {
                        nsamepad = 0;
                    }

                    double_pads[tech + "/" + deviceName] = nsamepad + 1;

                    ini.WriteValue(gcpad, "Device", tech + "/" + nsamepad.ToString() + "/" + deviceName);

                    if (extraOptions != null)
                    {
                        foreach (var xtra in extraOptions)
                        {
                            ini.WriteValue(gcpad, xtra.Key, xtra.Value);
                        }
                    }

                    foreach (var x in anyMapping)
                    {
                        string keyName = x.Value;

                        if (pad.Config.Type == "keyboard")
                        {
                            var value = x.Value;

                            if (x.Key == InputKey.a)
                            {
                                value = "Buttons/A";
                            }
                            else if (x.Key == InputKey.b)
                            {
                                value = "Buttons/B";
                            }
                            else if (x.Key == InputKey.up)
                            {
                                value = "Main Stick/Up";
                            }
                            else if (x.Key == InputKey.down)
                            {
                                value = "Main Stick/Down";
                            }
                            else if (x.Key == InputKey.left)
                            {
                                value = "Main Stick/Left";
                            }
                            else if (x.Key == InputKey.right)
                            {
                                value = "Main Stick/Right";
                            }

                            if (x.Key == InputKey.joystick1left || x.Key == InputKey.joystick1up)
                            {
                                continue;
                            }

                            var input = pad.Config[x.Key];
                            if (input == null)
                            {
                                continue;
                            }

                            var name = ToDolphinKey(input.Id);
                            ini.WriteValue(gcpad, value, name);
                        }
                        else if (tech == "XInput")
                        {
                            var mapping = pad.Config.GetXInputMapping(x.Key);
                            if (mapping != XINPUTMAPPING.UNKNOWN && xInputMapping.ContainsKey(mapping))
                            {
                                ini.WriteValue(gcpad, x.Value, xInputMapping[mapping]);
                            }

                            string reverseAxis;
                            if (anyReverseAxes.TryGetValue(x.Value, out reverseAxis))
                            {
                                mapping = pad.Config.GetXInputMapping(x.Key, true);
                                if (mapping != XINPUTMAPPING.UNKNOWN && xInputMapping.ContainsKey(mapping))
                                {
                                    ini.WriteValue(gcpad, reverseAxis, xInputMapping[mapping]);
                                }
                            }
                        }
                        else
                        {
                            var input = pad.Config[x.Key];
                            if (input == null)
                            {
                                continue;
                            }

                            if (input.Type == "button")
                            {
                                if (input.Id == 0) // Invert A & B
                                {
                                    ini.WriteValue(gcpad, x.Value, "`Button 1`");
                                }
                                else if (input.Id == 1) // Invert A & B
                                {
                                    ini.WriteValue(gcpad, x.Value, "`Button 0`");
                                }
                                else
                                {
                                    ini.WriteValue(gcpad, x.Value, "`Button " + input.Id.ToString() + "`");
                                }
                            }
                            else if (input.Type == "hat")
                            {
                                string hat = "`Hat " + input.Id + " N`";

                                if (input.Value == 2) // SDL_HAT_RIGHT
                                {
                                    hat = "`Hat " + input.Id + " E`";
                                }
                                else if (input.Value == 4) // SDL_HAT_DOWN
                                {
                                    hat = "`Hat " + input.Id + " S`";
                                }
                                else if (input.Value == 8) // SDL_HAT_LEFT
                                {
                                    hat = "`Hat " + input.Id + " W`";
                                }

                                ini.WriteValue(gcpad, x.Value, hat);
                            }
                            else if (input.Type == "axis")
                            {
                                Func <Input, bool, string> axisValue = (inp, revertAxis) =>
                                {
                                    string axis = "`Axis ";

                                    if (inp.Id == 2 || inp.Id == 5)
                                    {
                                        axis += "Z";
                                    }
                                    else if (inp.Id == 0 || inp.Id == 3)
                                    {
                                        axis += "X";
                                    }
                                    else
                                    {
                                        axis += "Y";
                                    }

                                    if (inp.Id == 3 || inp.Id == 4)
                                    {
                                        axis += "r";
                                    }

                                    if (inp.Id == 5)
                                    {
                                        revertAxis = !revertAxis;
                                    }

                                    if ((!revertAxis && inp.Value > 0) || (revertAxis && inp.Value < 0))
                                    {
                                        axis += "+";
                                    }
                                    else
                                    {
                                        axis += "-";
                                    }

                                    return(axis + "`");
                                };

                                ini.WriteValue(gcpad, x.Value, axisValue(input, false));

                                string reverseAxis;
                                if (anyReverseAxes.TryGetValue(x.Value, out reverseAxis))
                                {
                                    ini.WriteValue(gcpad, reverseAxis, axisValue(input, true));
                                }
                            }
                        }
                    }

                    if (tech == "XInput")
                    {
//                        ini.WriteValue(gcpad, "Main Stick/Modifier", "`Thumb L`");
//                      ini.WriteValue(gcpad, "C-Stick/Modifier" , "`Thumb R`");
                        ini.WriteValue(gcpad, "Main Stick/Dead Zone", "5.0000000000000000");
                        ini.WriteValue(gcpad, "C-Stick/Dead Zone", "5.0000000000000000");
                        ini.WriteValue(gcpad, "Rumble/Motor", "`Motor L``Motor R`");
                    }
                }

                ini.Save();
            }
        }
コード例 #6
0
        public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution)
        {
            string path = AppConfig.GetFullPath("supermodel");

            string exe = Path.Combine(path, "supermodel.exe");

            if (!File.Exists(exe))
            {
                return(null);
            }

            List <string> args = new List <string>();

            bool isWideScreen = false;

            if (resolution != null)
            {
                isWideScreen = ((float)resolution.Width / (float)resolution.Height) > 1.75f;
                args.Add("-res=" + resolution.Width + "," + resolution.Height);
            }
            else
            {
                isWideScreen = ((float)Screen.PrimaryScreen.Bounds.Width / (float)Screen.PrimaryScreen.Bounds.Height) >= 1.75f;
                args.Add("-res=" + Screen.PrimaryScreen.Bounds.Width + "," + Screen.PrimaryScreen.Bounds.Height);
            }

            _resolution = resolution;

            bool wideScreen = SystemConfig["widescreen"] == "1" || SystemConfig["widescreen"] == "2" || (!SystemConfig.isOptSet("widescreen") && isWideScreen);

            if (wideScreen)
            {
                ReshadeManager.Setup(ReshadeBezelType.opengl, null, null, path, resolution);

                args.Add("-fullscreen");

                if (SystemConfig["widescreen"] == "2")
                {
                    args.Add("-stretch");
                }
                else
                {
                    args.Add("-wide-screen");
                }
            }
            else
            {
                if (ReshadeManager.Setup(ReshadeBezelType.opengl, system, rom, path, resolution))
                {
                    args.Add("-fullscreen");
                }
                else
                {
                    _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution);
                    if (_bezelFileInfo == null)
                    {
                        args.Add("-fullscreen");
                    }
                }
            }

            // quad rendering
            if (SystemConfig.isOptSet("quadRendering") && SystemConfig.getOptBoolean("quadRendering"))
            {
                args.Add("-quad-rendering");
            }

            // crosshairs
            if (SystemConfig.isOptSet("crosshairs"))
            {
                args.Add("-crosshairs=" + SystemConfig["crosshairs"]);
            }

            // force feedback
            if (SystemConfig.isOptSet("forceFeedback") && SystemConfig.getOptBoolean("forceFeedback"))
            {
                args.Add("-force-feedback");
            }

            try
            {
                string iniPath = Path.Combine(path, "Config", "Supermodel.ini");
                if (File.Exists(iniPath))
                {
                    using (IniFile ini = new IniFile(iniPath, false))
                    {
                        ini.WriteValue(" Global ", "FullScreen", _bezelFileInfo == null ? "1" : "0");
                        ini.WriteValue(" Global ", "WideScreen", wideScreen ? "1" : "0");
                        ini.Save();
                    }
                }
            }
            catch { }


            if (SystemConfig["VSync"] != "false")
            {
                args.Add("-vsync");
            }

            args.Add("\"" + rom + "\"");

            return(new ProcessStartInfo()
            {
                FileName = exe,
                Arguments = string.Join(" ", args),
                WorkingDirectory = path,
            });
        }