public static void Read(Switch device) { string iniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string iniPath = Path.Combine(iniFolder, "Ryujinx.conf"); IniParser parser = new IniParser(iniPath); GraphicsConfig.ShadersDumpPath = parser.Value("Graphics_Shaders_Dump_Path"); Logger.SetEnable(LogLevel.Debug, Convert.ToBoolean(parser.Value("Logging_Enable_Debug"))); Logger.SetEnable(LogLevel.Stub, Convert.ToBoolean(parser.Value("Logging_Enable_Stub"))); Logger.SetEnable(LogLevel.Info, Convert.ToBoolean(parser.Value("Logging_Enable_Info"))); Logger.SetEnable(LogLevel.Warning, Convert.ToBoolean(parser.Value("Logging_Enable_Warn"))); Logger.SetEnable(LogLevel.Error, Convert.ToBoolean(parser.Value("Logging_Enable_Error"))); string[] filteredLogClasses = parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries); //When the classes are specified on the list, we only //enable the classes that are on the list. //So, first disable everything, then enable //the classes that the user added to the list. if (filteredLogClasses.Length > 0) { foreach (LogClass Class in Enum.GetValues(typeof(LogClass))) { Logger.SetEnable(Class, false); } } foreach (string logClass in filteredLogClasses) { if (!string.IsNullOrEmpty(logClass.Trim())) { foreach (LogClass Class in Enum.GetValues(typeof(LogClass))) { if (Class.ToString().ToLower().Contains(logClass.Trim().ToLower())) { Logger.SetEnable(Class, true); } } } } device.System.State.DockedMode = Convert.ToBoolean(parser.Value("Docked_Mode")); device.EnableDeviceVsync = Convert.ToBoolean(parser.Value("Enable_Vsync")); if (Convert.ToBoolean(parser.Value("Enable_MultiCore_Scheduling"))) { device.System.EnableMultiCoreScheduling(); } device.System.FsIntegrityCheckLevel = Convert.ToBoolean(parser.Value("Enable_FS_Integrity_Checks")) ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None; JoyConKeyboard = new JoyConKeyboard( new JoyConKeyboardLeft { StickUp = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Stick_Up")), StickDown = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Stick_Down")), StickLeft = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Stick_Left")), StickRight = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Stick_Right")), StickButton = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Stick_Button")), DPadUp = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_DPad_Up")), DPadDown = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_DPad_Down")), DPadLeft = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_DPad_Left")), DPadRight = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_DPad_Right")), ButtonMinus = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Button_Minus")), ButtonL = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Button_L")), ButtonZl = Convert.ToInt16(parser.Value("Controls_Left_JoyConKeyboard_Button_ZL")) }, new JoyConKeyboardRight { StickUp = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Stick_Up")), StickDown = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Stick_Down")), StickLeft = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Stick_Left")), StickRight = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Stick_Right")), StickButton = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Stick_Button")), ButtonA = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Button_A")), ButtonB = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Button_B")), ButtonX = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Button_X")), ButtonY = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Button_Y")), ButtonPlus = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Button_Plus")), ButtonR = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Button_R")), ButtonZr = Convert.ToInt16(parser.Value("Controls_Right_JoyConKeyboard_Button_ZR")) }); JoyConController = new JoyConController( Convert.ToBoolean(parser.Value("GamePad_Enable")), Convert.ToInt32(parser.Value("GamePad_Index")), (float)Convert.ToDouble(parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture), (float)Convert.ToDouble(parser.Value("GamePad_Trigger_Threshold"), CultureInfo.InvariantCulture), new JoyConControllerLeft { Stick = ToId(parser.Value("Controls_Left_JoyConController_Stick")), StickButton = ToId(parser.Value("Controls_Left_JoyConController_Stick_Button")), DPadUp = ToId(parser.Value("Controls_Left_JoyConController_DPad_Up")), DPadDown = ToId(parser.Value("Controls_Left_JoyConController_DPad_Down")), DPadLeft = ToId(parser.Value("Controls_Left_JoyConController_DPad_Left")), DPadRight = ToId(parser.Value("Controls_Left_JoyConController_DPad_Right")), ButtonMinus = ToId(parser.Value("Controls_Left_JoyConController_Button_Minus")), ButtonL = ToId(parser.Value("Controls_Left_JoyConController_Button_L")), ButtonZl = ToId(parser.Value("Controls_Left_JoyConController_Button_ZL")) }, new JoyConControllerRight { Stick = ToId(parser.Value("Controls_Right_JoyConController_Stick")), StickButton = ToId(parser.Value("Controls_Right_JoyConController_Stick_Button")), ButtonA = ToId(parser.Value("Controls_Right_JoyConController_Button_A")), ButtonB = ToId(parser.Value("Controls_Right_JoyConController_Button_B")), ButtonX = ToId(parser.Value("Controls_Right_JoyConController_Button_X")), ButtonY = ToId(parser.Value("Controls_Right_JoyConController_Button_Y")), ButtonPlus = ToId(parser.Value("Controls_Right_JoyConController_Button_Plus")), ButtonR = ToId(parser.Value("Controls_Right_JoyConController_Button_R")), ButtonZr = ToId(parser.Value("Controls_Right_JoyConController_Button_ZR")) }); }
public static void Read(Logger Log) { string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string IniPath = Path.Combine(IniFolder, "Ryujinx.conf"); IniParser Parser = new IniParser(IniPath); AOptimizations.DisableMemoryChecks = !Convert.ToBoolean(Parser.Value("Enable_Memory_Checks")); Log.SetEnable(LogLevel.Debug, Convert.ToBoolean(Parser.Value("Logging_Enable_Debug"))); Log.SetEnable(LogLevel.Stub, Convert.ToBoolean(Parser.Value("Logging_Enable_Stub"))); Log.SetEnable(LogLevel.Info, Convert.ToBoolean(Parser.Value("Logging_Enable_Info"))); Log.SetEnable(LogLevel.Warning, Convert.ToBoolean(Parser.Value("Logging_Enable_Warn"))); Log.SetEnable(LogLevel.Error, Convert.ToBoolean(Parser.Value("Logging_Enable_Error"))); GamePadEnable = Convert.ToBoolean(Parser.Value("GamePad_Enable")); GamePadIndex = Convert.ToInt32(Parser.Value("GamePad_Index")); GamePadDeadzone = (float)Convert.ToDouble(Parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture); GamePadTriggerThreshold = (float)Convert.ToDouble(Parser.Value("GamePad_Trigger_Threshold"), CultureInfo.InvariantCulture); string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries); //When the classes are specified on the list, we only //enable the classes that are on the list. //So, first disable everything, then enable //the classes that the user added to the list. if (FilteredLogClasses.Length > 0) { foreach (LogClass Class in Enum.GetValues(typeof(LogClass))) { Log.SetEnable(Class, false); } } foreach (string LogClass in FilteredLogClasses) { if (!string.IsNullOrEmpty(LogClass.Trim())) { foreach (LogClass Class in Enum.GetValues(typeof(LogClass))) { if (Class.ToString().ToLower().Contains(LogClass.Trim().ToLower())) { Log.SetEnable(Class, true); } } } } JoyConKeyboard = new JoyConKeyboard { Left = new JoyConKeyboardLeft { StickUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Up")), StickDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Down")), StickLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Left")), StickRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Right")), StickButton = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Button")), DPadUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Up")), DPadDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Down")), DPadLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Left")), DPadRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Right")), ButtonMinus = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_Minus")), ButtonL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_L")), ButtonZL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_ZL")) }, Right = new JoyConKeyboardRight { StickUp = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Up")), StickDown = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Down")), StickLeft = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Left")), StickRight = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Right")), StickButton = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Button")), ButtonA = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_A")), ButtonB = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_B")), ButtonX = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_X")), ButtonY = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Y")), ButtonPlus = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Plus")), ButtonR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_R")), ButtonZR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_ZR")) } }; JoyConController = new JoyConController { Left = new JoyConControllerLeft { Stick = Parser.Value("Controls_Left_JoyConController_Stick"), StickButton = Parser.Value("Controls_Left_JoyConController_Stick_Button"), DPadUp = Parser.Value("Controls_Left_JoyConController_DPad_Up"), DPadDown = Parser.Value("Controls_Left_JoyConController_DPad_Down"), DPadLeft = Parser.Value("Controls_Left_JoyConController_DPad_Left"), DPadRight = Parser.Value("Controls_Left_JoyConController_DPad_Right"), ButtonMinus = Parser.Value("Controls_Left_JoyConController_Button_Minus"), ButtonL = Parser.Value("Controls_Left_JoyConController_Button_L"), ButtonZL = Parser.Value("Controls_Left_JoyConController_Button_ZL") }, Right = new JoyConControllerRight { Stick = Parser.Value("Controls_Right_JoyConController_Stick"), StickButton = Parser.Value("Controls_Right_JoyConController_Stick_Button"), ButtonA = Parser.Value("Controls_Right_JoyConController_Button_A"), ButtonB = Parser.Value("Controls_Right_JoyConController_Button_B"), ButtonX = Parser.Value("Controls_Right_JoyConController_Button_X"), ButtonY = Parser.Value("Controls_Right_JoyConController_Button_Y"), ButtonPlus = Parser.Value("Controls_Right_JoyConController_Button_Plus"), ButtonR = Parser.Value("Controls_Right_JoyConController_Button_R"), ButtonZR = Parser.Value("Controls_Right_JoyConController_Button_ZR") } }; }