Skip to content

Commit c51465b

Browse files
committed
[ZZZ GSP] Fix resolution rounding error
1 parent 2aecbb9 commit c51465b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/ZenlessGameSettingsPage.xaml.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ private void InitializeSettings(object sender, RoutedEventArgs e)
174174
List<string> resWindowed = GetResPairs_Windowed();
175175

176176
// Add the index of fullscreen and windowed resolution booleans
177+
ScreenResolutionIsFullscreenIdx.Add(true);
177178
ScreenResolutionIsFullscreenIdx.AddRange(Enumerable.Range(0, resFullscreen.Count).Select(_ => true));
178179
ScreenResolutionIsFullscreenIdx.AddRange(Enumerable.Range(0, resWindowed.Count).Select(_ => false));
179180

@@ -268,7 +269,7 @@ private List<string> GetResPairs_Fullscreen(System.Drawing.Size defaultResolutio
268269
{
269270
// Get height and calculate width
270271
int h = acH[i];
271-
int w = (int)(h * nativeAspRatio);
272+
int w = (int)Math.Round(h * nativeAspRatio);
272273

273274
// If the resolution is the same as default, set the index
274275
if (h == defaultResolution.Height && w == defaultResolution.Width)
@@ -302,10 +303,14 @@ private List<string> GetResPairs_Windowed()
302303
// If res is 21:9 then add proper native to the list
303304
if (Math.Abs(nativeAspRatio - ulWideRatio) < 0.01)
304305
resPairs.Add($"{SizeProp.Width}x{SizeProp.Height}");
305-
306-
foreach (var h in acH)
306+
307+
for (int i = 0; i < acH.Count; i++)
307308
{
308-
int w = (int)(h * wideRatio);
309+
// Get height and calculate width
310+
int h = acH[i];
311+
int w = (int)Math.Round(h * wideRatio);
312+
313+
// Add the resolution pair to the list
309314
resPairs.Add(string.Format(Lang._GameSettingsPage.Graphics_ResPrefixWindowed, w, h));
310315
}
311316

0 commit comments

Comments
 (0)