mirror of https://github.com/ppy/osu
Add default resolution to avoid crashing
This commit is contained in:
parent
cc533a05c5
commit
c1cdff8505
|
@ -102,13 +102,18 @@ private void load(FrameworkConfigManager config, OsuGameBase game)
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<KeyValuePair<string, Size>> getResolutions() =>
|
private IEnumerable<KeyValuePair<string, Size>> getResolutions()
|
||||||
game.Window?.AvailableResolutions?
|
{
|
||||||
.Where(r => r.Width >= 800 && r.Height >= 600)
|
var resolutions = new KeyValuePair<string, Size>("Default", new Size(9999, 9999)).Yield();
|
||||||
.OrderByDescending(r => r.Width)
|
|
||||||
.ThenByDescending(r => r.Height)
|
if (game.Window != null)
|
||||||
.Select(res => new KeyValuePair<string, Size>($"{res.Width}x{res.Height}", new Size(res.Width, res.Height)))
|
resolutions = resolutions.Concat(game.Window.AvailableResolutions
|
||||||
.Distinct()
|
.Where(r => r.Width >= 800 && r.Height >= 600)
|
||||||
.ToList() ?? new KeyValuePair<string, Size>("Default", new Size(9999, 9999)).Yield();
|
.OrderByDescending(r => r.Width)
|
||||||
|
.ThenByDescending(r => r.Height)
|
||||||
|
.Select(res => new KeyValuePair<string, Size>($"{res.Width}x{res.Height}", new Size(res.Width, res.Height)))
|
||||||
|
.Distinct()).ToList();
|
||||||
|
return resolutions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue