DXGL r418 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r417
|
r418
|
r419
>
Date:
00:19, 4 April 2014
Author:
admin
Status:
new
Tags:
Comment:
Custom aspect correction for scaler mode 5. Note that this will only work properly if the display is set to a mode that has square pixels on the screen, and no match is found when changing modes.
Modified paths:
/cfgmgr/ReadMe.txt
(modified) (
history
)
/ddraw/glDirectDraw.cpp
(modified) (
history
)
Diff
[
purge
]
Index: cfgmgr/ReadMe.txt
—
—
@@ -133,7 +133,7 @@
134
134
135
135
Member aspect
136
136
REG_DWORD HKCU\DXGL\<app>\ScreenAspect
137
-Screen aspect ratio to simulate, if the scaler is 1 or 4.
137
+Screen aspect ratio to simulate, if the scaler is 1 or 5.
138
138
Stored as a 32-bit float encoded as a DWORD.
139
139
If zero, negative, or an invalid value, use automatic ratio based on square pixels.
140
140
Positive values indicate a specific screen aspect ratio.
Index: ddraw/glDirectDraw.cpp
—
—
@@ -1512,20 +1512,37 @@
1513
1513
screenx = newmode2.dmPelsWidth;
1514
1514
primaryy = dwHeight;
1515
1515
screeny = newmode2.dmPelsHeight;
1516
- aspect = (float)dwWidth / (float)dwHeight;
1517
- xmul = (float)screenx / (float)dwWidth;
1518
- ymul = (float)screeny / (float)dwHeight;
1519
- if((float)dwWidth*(float)ymul > (float)screenx)
1516
+ if (_isnan(dxglcfg.aspect) || dxglcfg.aspect <= 0)
1520
1517
{
1521
- internalx = (DWORD)((float)dwWidth * (float)xmul);
1522
- internaly = (DWORD)((float)dwHeight * (float)xmul);
1518
+ aspect = (float)dwWidth / (float)dwHeight;
1519
+ xmul = (float)screenx / (float)dwWidth;
1520
+ ymul = (float)screeny / (float)dwHeight;
1521
+ if ((float)dwWidth*(float)ymul > (float)screenx)
1522
+ {
1523
+ internalx = (DWORD)((float)dwWidth * (float)xmul);
1524
+ internaly = (DWORD)((float)dwHeight * (float)xmul);
1525
+ }
1526
+ else
1527
+ {
1528
+ internalx = (DWORD)((float)dwWidth * (float)ymul);
1529
+ internaly = (DWORD)((float)dwHeight * (float)ymul);
1530
+ }
1523
1531
}
1524
1532
else
1525
1533
{
1526
- internalx = (DWORD)((float)dwWidth * (float)ymul);
1527
- internaly = (DWORD)((float)dwHeight * (float)ymul);
1534
+ aspect = dxglcfg.aspect;
1535
+ if (screenx*aspect > screeny)
1536
+ {
1537
+ internalx = (DWORD)((float)screeny / (float)aspect);
1538
+ internaly = screeny;
1539
+ }
1540
+ else
1541
+ {
1542
+ internalx = screenx;
1543
+ internaly = (DWORD)((float)screenx * (float)aspect);
1544
+ }
1528
1545
}
1529
- if(dxglcfg.colormode) internalbpp = screenbpp = dwBPP;
1546
+ if (dxglcfg.colormode) internalbpp = screenbpp = dwBPP;
1530
1547
else internalbpp = screenbpp = newmode2.dmBitsPerPel;
1531
1548
if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
1532
1549
else internalrefresh = primaryrefresh = screenrefresh = newmode2.dmDisplayFrequency;
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version